ObjFW  Diff

Differences From Artifact [3efdd5018a]:

To Artifact [f8e93c416d]:

  • File src/OFGZIPStream.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: 7342) [annotate] [blame] [check-ins using] [more...]


61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
	}

	return self;
}

- (void)dealloc
{

	[self close];

	[_inflateStream release];
	[_modificationDate release];

	[super dealloc];
}








>
|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	}

	return self;
}

- (void)dealloc
{
	if (_stream != nil)
		[self close];

	[_inflateStream release];
	[_modificationDate release];

	[super dealloc];
}

319
320
321
322
323
324
325



326
327
328
329
330
331
		    _inflateStream.hasDataInReadBuffer);

	return (super.hasDataInReadBuffer || _stream.hasDataInReadBuffer);
}

- (void)close
{



	[_stream release];
	_stream = nil;

	[super close];
}
@end







>
>
>






320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
		    _inflateStream.hasDataInReadBuffer);

	return (super.hasDataInReadBuffer || _stream.hasDataInReadBuffer);
}

- (void)close
{
	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	[_stream release];
	_stream = nil;

	[super close];
}
@end