Fix the recursive lock bug.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17171 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2003-07-08 01:10:48 +00:00
parent 57103df2fa
commit 98fc078d86
2 changed files with 24 additions and 5 deletions

View file

@ -1,3 +1,12 @@
2003-07-08 03:03 Alexander Malmberg <alexander@malmberg.org>
* 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 <d.ayers@inode.at> 2003-07-07 David Ayers <d.ayers@inode.at>
* Headers/gnustep/base/GSObjCRuntime.h: * Headers/gnustep/base/GSObjCRuntime.h:

View file

@ -3209,6 +3209,7 @@ static void callEncoder (DOContext *ctxt)
if (node != 0) if (node != 0)
{ {
proxy = node->value.obj; proxy = node->value.obj;
M_UNLOCK(global_proxies_gate);
} }
else else
{ {
@ -3217,17 +3218,24 @@ static void callEncoder (DOContext *ctxt)
counter = NSMapGet (targetToCounter, (void*)target); counter = NSMapGet (targetToCounter, (void*)target);
if (counter == nil) if (counter == nil)
{ {
CachedLocalObject *cached;
/* /*
* If the target doesn't exist for any connection, but still * If the target doesn't exist for any connection, but still
* persists in the cache (ie it was recently released) then * persists in the cache (ie it was recently released) then
* we move it back from the cache to the main maps so we can * we move it back from the cache to the main maps so we can
* retain it on this connection. * retain it on this connection.
*/ */
counter = NSMapGet (targetToCached, (void*)target); cached = NSMapGet (targetToCached, (void*)target);
if (counter != nil) if (cached != nil)
{ {
unsigned t = counter->target; unsigned t;
id o = counter->object; id o;
counter = [cached obj];
t = counter->target;
o = counter->object;
NSMapInsert(objectToCounter, (void*)o, counter); NSMapInsert(objectToCounter, (void*)o, counter);
NSMapInsert(targetToCounter, (void*)t, counter); NSMapInsert(targetToCounter, (void*)t, counter);
@ -3237,6 +3245,7 @@ static void callEncoder (DOContext *ctxt)
} }
} }
RETAIN(counter); RETAIN(counter);
M_UNLOCK(global_proxies_gate);
if (counter == nil) if (counter == nil)
{ {
if(debug_connection > 3) if(debug_connection > 3)
@ -3244,6 +3253,8 @@ static void callEncoder (DOContext *ctxt)
} }
else else
{ {
NSAssert([counter isKindOfClass: [GSLocalCounter class]],
@"Local counter is wrong kind of class.");
proxy = [distantObjectClass proxyWithLocal: counter->object proxy = [distantObjectClass proxyWithLocal: counter->object
connection: self]; connection: self];
if (debug_connection > 3) if (debug_connection > 3)
@ -3252,7 +3263,6 @@ static void callEncoder (DOContext *ctxt)
RELEASE(counter); RELEASE(counter);
} }
} }
M_UNLOCK(global_proxies_gate);
return proxy; return proxy;
} }