Differences From Artifact [9fd5fb5c63]:
- File
src/OFTarArchive.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: 10273) [annotate] [blame] [check-ins using]
To Artifact [fe80dcdcf2]:
- File src/OFTarArchive.m — part of check-in [1d6d3eb61c] at 2020-02-16 18:22:59 on branch trunk — OF{LHA,Tar,ZIP}Archive: Gracefully handle close (user: js, size: 10615) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
174 175 176 177 178 179 180 | } buffer; bool empty = true; if (_mode != OF_TAR_ARCHIVE_MODE_READ) @throw [OFInvalidArgumentException exception]; [(OFTarArchiveFileReadStream *)_lastReturnedStream of_skip]; | > | > > > | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | } buffer; bool empty = true; if (_mode != OF_TAR_ARCHIVE_MODE_READ) @throw [OFInvalidArgumentException exception]; [(OFTarArchiveFileReadStream *)_lastReturnedStream of_skip]; @try { [_lastReturnedStream close]; } @catch (OFNotOpenException *e) { /* Might have already been closed by the user - that's fine. */ } [_lastReturnedStream release]; _lastReturnedStream = nil; if (_stream.atEndOfStream) return nil; [_stream readIntoBuffer: buffer.c |
︙ | ︙ | |||
233 234 235 236 237 238 239 | if (_mode != OF_TAR_ARCHIVE_MODE_WRITE && _mode != OF_TAR_ARCHIVE_MODE_APPEND) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); | > | > > > | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | if (_mode != OF_TAR_ARCHIVE_MODE_WRITE && _mode != OF_TAR_ARCHIVE_MODE_APPEND) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); @try { [_lastReturnedStream close]; } @catch (OFNotOpenException *e) { /* Might have already been closed by the user - that's fine. */ } [_lastReturnedStream release]; _lastReturnedStream = nil; [entry of_writeToStream: _stream encoding: _encoding]; _lastReturnedStream = [[OFTarArchiveFileWriteStream alloc] |
︙ | ︙ | |||
255 256 257 258 259 260 261 | } - (void)close { if (_stream == nil) return; | > | > > > | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | } - (void)close { if (_stream == nil) return; @try { [_lastReturnedStream close]; } @catch (OFNotOpenException *e) { /* Might have already been closed by the user - that's fine. */ } [_lastReturnedStream release]; _lastReturnedStream = nil; if (_mode == OF_TAR_ARCHIVE_MODE_WRITE || _mode == OF_TAR_ARCHIVE_MODE_APPEND) { char buffer[1024]; memset(buffer, '\0', 1024); |
︙ | ︙ |