Differences From Artifact [7babcc132e]:
- File src/OFProcess.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 14211) [annotate] [blame] [check-ins using] [more...]
To Artifact [dc3506687f]:
- File
src/OFProcess.m
— part of check-in
[3b43d51006]
at
2020-01-14 00:16:04
on branch trunk
— More consistent -[close] behavior
This means refusing to close twice, calling -[close] from -[dealloc] and
not calling -[cancelAsyncRequests].Calling -[cancelAsyncRequests] in -[close] is too dangerous, as -[close]
gets called by -[dealloc]: If the queue is the last reference to the
object, at the point where -[cancelAsyncRequests] removes it from the
queue, the object will start to deallocate and call into
-[cancelAsyncRequests] again, which is still in the middle of removing
it and now finds itself with an inconsistent state. (user: js, size: 14308) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
324 325 326 327 328 329 330 | } return self; } - (void)dealloc { | > > > > > | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | } return self; } - (void)dealloc { #ifndef OF_WINDOWS if (_readPipe[0] != -1) #else if (_readPipe[0] != NULL) #endif [self close]; [super dealloc]; } #ifndef OF_WINDOWS - (void)of_getArgv: (char ***)argv forProgramName: (OFString *)programName |
︙ | ︙ | |||
554 555 556 557 558 559 560 | _writePipe[1] = NULL; #endif } - (void)close { #ifndef OF_WINDOWS | | > > > | < < < | > > > | < < < | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | _writePipe[1] = NULL; #endif } - (void)close { #ifndef OF_WINDOWS if (_readPipe[0] == -1) @throw [OFNotOpenException exceptionWithObject: self]; [self closeForWriting]; close(_readPipe[0]); if (_pid != -1) { kill(_pid, SIGTERM); waitpid(_pid, &_status, WNOHANG); } _pid = -1; _readPipe[0] = -1; #else if (_readPipe[0] == NULL) @throw [OFNotOpenException exceptionWithObject: self]; [self closeForWriting]; CloseHandle(_readPipe[0]); if (_process != INVALID_HANDLE_VALUE) { TerminateProcess(_process, 0); CloseHandle(_process); } _process = INVALID_HANDLE_VALUE; _readPipe[0] = NULL; #endif [super close]; } @end |