diff --git a/ChangeLog b/ChangeLog index ce46f6b7f..e3b50c6da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * Source/NSDebug.m: Remove checks for existence of lock ... it always exists, so the checks are useless. + * Source/NSThread.m: Refrain from creating thread dictionary in an + inactive thread ... we don't want to create new objects in a thread + which is in the process of exiting. 2004-09-24 Richard Frith-Macdonald diff --git a/Source/NSThread.m b/Source/NSThread.m index 1f355817a..d2ac1f9eb 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -53,6 +53,8 @@ @class GSPerformHolder; +typedef struct { @defs(NSThread) } NSThread_ivars; + static Class threadClass = Nil; static NSNotificationCenter *nc = nil; @@ -261,7 +263,8 @@ GSCurrentThread(void) } /** - * Fast access function for thread dictionary of current thread. + * Fast access function for thread dictionary of current thread.
+ * If there is no dictionary, and the thread is active, creates the dictionary. */ NSMutableDictionary* GSDictionaryForThread(NSThread *t) @@ -278,7 +281,7 @@ GSDictionaryForThread(NSThread *t) { NSMutableDictionary *dict = t->_thread_dictionary; - if (dict == nil) + if (dict == nil && ((NSThread_ivars *)t)->_active == YES) { dict = [t threadDictionary]; } @@ -313,7 +316,9 @@ NSTimer *GSHousekeeper(void) /** * Returns the runloop for the specified thread (or, if t is nil, - * for the current thread). Creates a new runloop if necessary.
+ * for the current thread).
+ * Creates a new runloop if necessary, + * as long as the thread dictionary exists.
* Returns nil on failure. */ NSRunLoop* @@ -1066,9 +1071,6 @@ static NSDate *theFuture; } @end -typedef struct { @defs(NSThread) } NSThread_ivars; - - /** *

* This function is provided to let threads started by some other