Differences From Artifact [8a16e3648e]:
- File src/OFFile.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 11756) [annotate] [blame] [check-ins using] [more...]
To Artifact [1f08d5d8ea]:
- File
src/OFFile.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: 11853) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
526 527 528 529 530 531 532 | { return _handle; } #endif - (void)close { | | | > > | | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | { return _handle; } #endif - (void)close { if (_handle == OF_INVALID_FILE_HANDLE) @throw [OFNotOpenException exceptionWithObject: self]; closeHandle(_handle); _handle = OF_INVALID_FILE_HANDLE; [super close]; } - (void)dealloc { if (_handle != OF_INVALID_FILE_HANDLE) [self close]; [super dealloc]; } @end |