mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
More debugging cleanups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27782 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ef8b37000e
commit
be86199404
3 changed files with 37 additions and 30 deletions
|
@ -3,6 +3,7 @@
|
|||
* Source/NSURLProtocol.m: Add some diagnostics and ensure that
|
||||
delegates are removed from streams.
|
||||
* Source/NSURLConnection.m: Add diagnostics for redirect.
|
||||
* Source/GSStream.m: Set delegate to nil after failure.
|
||||
|
||||
2009-02-04 David Chisnall <csdavec@swansea.ac.uk>
|
||||
|
||||
|
|
|
@ -275,17 +275,22 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
|
||||
- (void) setDelegate: (id)delegate
|
||||
{
|
||||
if (delegate)
|
||||
if ([self streamStatus] == NSStreamStatusClosed
|
||||
|| [self streamStatus] == NSStreamStatusError)
|
||||
{
|
||||
_delegate = delegate;
|
||||
_delegateValid = NO;
|
||||
_delegate = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
_delegate = self;
|
||||
}
|
||||
if ([self streamStatus] != NSStreamStatusClosed
|
||||
&& [self streamStatus] != NSStreamStatusError)
|
||||
{
|
||||
if (delegate)
|
||||
{
|
||||
_delegate = delegate;
|
||||
}
|
||||
else
|
||||
{
|
||||
_delegate = self;
|
||||
}
|
||||
/* We don't want to send any events the the delegate after the
|
||||
* stream has been closed.
|
||||
*/
|
||||
|
|
|
@ -129,10 +129,18 @@ static NSLock *pairLock = nil;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[ip release];
|
||||
[op release];
|
||||
[host release];
|
||||
[expires release];
|
||||
[ip setDelegate: nil];
|
||||
[op setDelegate: nil];
|
||||
[ip removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[op removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[ip close];
|
||||
[op close];
|
||||
DESTROY(ip);
|
||||
DESTROY(op);
|
||||
DESTROY(host);
|
||||
DESTROY(expires);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -537,14 +545,6 @@ static NSURLProtocol *placeholder = nil;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) _schedule
|
||||
{
|
||||
[this->input scheduleInRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->output scheduleInRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
- (void) setDebug: (BOOL)flag
|
||||
{
|
||||
_debug = flag;
|
||||
|
@ -696,20 +696,15 @@ static NSURLProtocol *placeholder = nil;
|
|||
}
|
||||
[this->input setDelegate: self];
|
||||
[this->output setDelegate: self];
|
||||
[self _schedule];
|
||||
[this->input scheduleInRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->output scheduleInRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->input open];
|
||||
[this->output open];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _unschedule
|
||||
{
|
||||
[this->input removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->output removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
- (void) stopLoading
|
||||
{
|
||||
if (_debug == YES)
|
||||
|
@ -722,7 +717,10 @@ static NSURLProtocol *placeholder = nil;
|
|||
{
|
||||
[this->input setDelegate: nil];
|
||||
[this->output setDelegate: nil];
|
||||
[self _unschedule];
|
||||
[this->input removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->output removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->input close];
|
||||
[this->output close];
|
||||
DESTROY(this->input);
|
||||
|
@ -1093,7 +1091,10 @@ static NSURLProtocol *placeholder = nil;
|
|||
}
|
||||
}
|
||||
|
||||
[self _unschedule];
|
||||
[this->input removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->output removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
if (_shouldClose == YES)
|
||||
{
|
||||
[this->input setDelegate: nil];
|
||||
|
|
Loading…
Reference in a new issue