diff --git a/ChangeLog b/ChangeLog index 21c1b4f2d..d64f06483 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ * Source/NSConnection.m: Fix thread related memory leak leaving an NSRunLoop in a connection when the connection is no longer using it. + * Source/NSURL.m: retain handle while doing background load. 2003-07-23 Richard Frith-Macdonald diff --git a/Source/NSURL.m b/Source/NSURL.m index 82730bcc7..6ad0fbf9b 100644 --- a/Source/NSURL.m +++ b/Source/NSURL.m @@ -1138,7 +1138,7 @@ static unsigned urlAlign; [clientsLock lock]; if (_clients == 0) { - _clients = NSCreateMapTable (NSNonRetainedObjectMapKeyCallBacks, + _clients = NSCreateMapTable (NSObjectMapKeyCallBacks, NSNonRetainedObjectMapValueCallBacks, 0); } NSMapInsert((NSMapTable*)_clients, (void*)handle, (void*)client); @@ -1566,6 +1566,8 @@ static unsigned urlAlign; { id c = clientForHandle(_clients, sender); + RETAIN(self); + [sender removeClient: self]; if (c != nil) { if ([c respondsToSelector: @selector(URLResourceDidFinishLoading:)]) @@ -1576,7 +1578,7 @@ static unsigned urlAlign; NSMapRemove((NSMapTable*)_clients, (void*)sender); [clientsLock unlock]; } - [sender removeClient: self]; + RELEASE(self); } @end