Differences From Artifact [dd17a9200e]:
- File src/OFLHAArchive.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 11771) [annotate] [blame] [check-ins using] [more...]
To Artifact [a09f2c8a17]:
- File
src/OFLHAArchive.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: 12018) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
148 149 150 151 152 153 154 | return self; } #endif - (void)dealloc { | > | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | return self; } #endif - (void)dealloc { if (_stream != nil) [self close]; [super dealloc]; } - (OFLHAArchiveEntry *)nextEntry { OFLHAArchiveEntry *entry; |
︙ | ︙ | |||
238 239 240 241 242 243 244 | return [[(OFLHAArchiveFileWriteStream *)_lastReturnedStream retain] autorelease]; } - (void)close { if (_stream == nil) | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | return [[(OFLHAArchiveFileWriteStream *)_lastReturnedStream retain] autorelease]; } - (void)close { if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; [_lastReturnedStream close]; [_lastReturnedStream release]; _lastReturnedStream = nil; [_stream release]; _stream = nil; |
︙ | ︙ | |||
293 294 295 296 297 298 299 | } return self; } - (void)dealloc { | > | < < | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | } return self; } - (void)dealloc { if (_stream != nil || _decompressedStream != nil) [self close]; [_entry release]; [super dealloc]; } - (bool)lowlevelIsAtEndOfStream { |
︙ | ︙ | |||
413 414 415 416 417 418 419 420 421 422 423 424 425 426 | _toRead = 0; _skipped = true; } - (void)close { [self of_skip]; [_stream release]; _stream = nil; [_decompressedStream release]; _decompressedStream = nil; | > > > | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | _toRead = 0; _skipped = true; } - (void)close { if (_stream == nil || _decompressedStream == nil) @throw [OFNotOpenException exceptionWithObject: self]; [self of_skip]; [_stream release]; _stream = nil; [_decompressedStream release]; _decompressedStream = nil; |
︙ | ︙ | |||
456 457 458 459 460 461 462 | } return self; } - (void)dealloc { | > | | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | } return self; } - (void)dealloc { if (_stream != nil) [self close]; [_entry release]; [super dealloc]; } - (size_t)lowlevelWriteBuffer: (const void *)buffer |
︙ | ︙ | |||
509 510 511 512 513 514 515 | } - (void)close { of_offset_t offset; if (_stream == nil) | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | } - (void)close { of_offset_t offset; if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; _entry.uncompressedSize = _bytesWritten; _entry.compressedSize = _bytesWritten; _entry.CRC16 = _CRC16; offset = [_stream seekToOffset: 0 whence:SEEK_CUR]; |
︙ | ︙ |