From 75124f39cc600bb85ad1794308035c3bb7e63daf Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Wed, 18 Jun 2008 13:13:42 +0000 Subject: [PATCH] backport bugfix git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/stable@26686 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 4 ++++ Source/NSConnection.m | 15 ++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b2a37004..0f74e9213 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-18 Richard Frith-Macdonald + + * Source/NSConnection.m: backport fix from trunk. + 2008-06-17 Richard Frith-Macdonald * Version 1.16.1 diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 49e45415a..5b40e8486 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -91,9 +91,10 @@ static inline NSRunLoop * GSRunLoopForThread(NSThread *aThread) { GSRunLoopThreadInfo *info = GSRunLoopInfoForThread(aThread); + if (info == nil || info->loop == nil) { - if (aThread == nil) + if (aThread == nil || aThread == GSCurrentThread()) { return [NSRunLoop currentRunLoop]; } @@ -1886,8 +1887,7 @@ static void retEncoder (DOContext *ctxt) const char *type; retval_t retframe; DOContext ctxt; - NSThread *thread = GSCurrentThread(); - NSRunLoop *runLoop = GSRunLoopForThread(thread); + NSRunLoop *runLoop = GSRunLoopForThread(nil); memset(&ctxt, 0, sizeof(ctxt)); ctxt.connection = self; @@ -2030,8 +2030,7 @@ static void retEncoder (DOContext *ctxt) BOOL needsResponse; const char *type; DOContext ctxt; - NSThread *thread = GSCurrentThread(); - NSRunLoop *runLoop = GSRunLoopForThread(thread); + NSRunLoop *runLoop = GSRunLoopForThread(nil); if ([_runLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) { @@ -2494,8 +2493,7 @@ static void callEncoder (DOContext *ctxt) */ NS_DURING { - NSThread *thread = GSCurrentThread(); - NSRunLoop *runLoop = GSRunLoopForThread(thread); + NSRunLoop *runLoop = GSRunLoopForThread(nil); NSParameterAssert (_isValid); if ([_runLoops indexOfObjectIdenticalTo: runLoop] == NSNotFound) @@ -2761,8 +2759,7 @@ static void callEncoder (DOContext *ctxt) NSTimeInterval last_interval = 0.0001; NSTimeInterval delay_interval = last_interval; NSDate *delay_date = nil; - NSThread *thread = GSCurrentThread(); - NSRunLoop *runLoop = GSRunLoopForThread(thread); + NSRunLoop *runLoop = GSRunLoopForThread(nil); BOOL isLocked = NO; /*