From 90c5c054cd748c7e26fd270b8f12f5da6c60c820 Mon Sep 17 00:00:00 2001 From: CaS Date: Fri, 29 Apr 2005 19:10:46 +0000 Subject: [PATCH] Tweak last change to avoid possible crashes. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21169 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/GSHTTPURLHandle.m | 28 +++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0f444c9b..26968f0ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-04-29 Richard Frith-Macdonald + + * Source/GSHTTPURLHandle.m: Remove self as an observer of our file + handle on deallocation ... prevent notfications being sent to + deallocated object. + 2005-04-28 Richard Frith-Macdonald * Documentation/coding-standards.texi: Added what appear to be the diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m index 229e50d42..4032c0e00 100644 --- a/Source/GSHTTPURLHandle.m +++ b/Source/GSHTTPURLHandle.m @@ -256,18 +256,28 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data) { if (sock != nil) { + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + + /* + * We might be in an idle state with an outstandng read on the + * socket, keeping the connection alive, but waiting for the + * remote end to drop it. + */ + [nc removeObserver: self + name: NSFileHandleReadCompletionNotification + object: sock]; [sock closeFile]; DESTROY(sock); } - RELEASE(u); - RELEASE(url); - RELEASE(dat); - RELEASE(parser); - RELEASE(document); - RELEASE(pageInfo); - RELEASE(wData); - RELEASE(wProperties); - RELEASE(request); + DESTROY(u); + DESTROY(url); + DESTROY(dat); + DESTROY(parser); + DESTROY(document); + DESTROY(pageInfo); + DESTROY(wData); + DESTROY(wProperties); + DESTROY(request); [super dealloc]; }