From 98fc078d86bbb14755df41a227425730a871c4e3 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 8 Jul 2003 01:10:48 +0000 Subject: [PATCH] Fix the recursive lock bug. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17171 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 9 +++++++++ Source/NSConnection.m | 20 +++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index df400cf3e..7aa6eb68b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-07-08 03:03 Alexander Malmberg + + * Source/NSConnection.m (-locateLocalTarget:): The targetToCached + map contains CachedLocalObject:s, not GSLocalCounter:s. Extract the + GSLocalCounter from the CachedLocalObject. + + Unlock the global_proxies_gate lock before calling + -proxyWithLocal:connection:. + 2003-07-07 David Ayers * Headers/gnustep/base/GSObjCRuntime.h: diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 40c2f81f9..1fbea9f16 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -3209,6 +3209,7 @@ static void callEncoder (DOContext *ctxt) if (node != 0) { proxy = node->value.obj; + M_UNLOCK(global_proxies_gate); } else { @@ -3217,17 +3218,24 @@ static void callEncoder (DOContext *ctxt) counter = NSMapGet (targetToCounter, (void*)target); if (counter == nil) { + CachedLocalObject *cached; + /* * If the target doesn't exist for any connection, but still * persists in the cache (ie it was recently released) then * we move it back from the cache to the main maps so we can * retain it on this connection. */ - counter = NSMapGet (targetToCached, (void*)target); - if (counter != nil) + cached = NSMapGet (targetToCached, (void*)target); + if (cached != nil) { - unsigned t = counter->target; - id o = counter->object; + unsigned t; + id o; + + counter = [cached obj]; + + t = counter->target; + o = counter->object; NSMapInsert(objectToCounter, (void*)o, counter); NSMapInsert(targetToCounter, (void*)t, counter); @@ -3237,6 +3245,7 @@ static void callEncoder (DOContext *ctxt) } } RETAIN(counter); + M_UNLOCK(global_proxies_gate); if (counter == nil) { if(debug_connection > 3) @@ -3244,6 +3253,8 @@ static void callEncoder (DOContext *ctxt) } else { + NSAssert([counter isKindOfClass: [GSLocalCounter class]], + @"Local counter is wrong kind of class."); proxy = [distantObjectClass proxyWithLocal: counter->object connection: self]; if (debug_connection > 3) @@ -3252,7 +3263,6 @@ static void callEncoder (DOContext *ctxt) RELEASE(counter); } } - M_UNLOCK(global_proxies_gate); return proxy; }