From 853f52049b50745ea0a6bbcf86c218d6cb0ff52d Mon Sep 17 00:00:00 2001 From: theraven Date: Mon, 11 Jul 2011 15:12:47 +0000 Subject: [PATCH] Do the things from the last commit in the correct order. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33523 72102866-910b-0410-8b05-ffd578937521 --- Source/NSThread.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/NSThread.m b/Source/NSThread.m index 48aabd3dd..f0c92f5f4 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -329,13 +329,14 @@ GSCurrentThread(void) NSThread *thr = pthread_getspecific(thread_object_key); if (nil == thr) { - GSRegisterCurrentThread(); + assert(GSRegisterCurrentThread() && @"Failed to register thread"); + thr = pthread_getspecific(thread_object_key); if ((defaultThread == nil) && IS_MAIN_PTHREAD) { - defaultThread = thr; + defaultThread = [thr retain]; } - thr = pthread_getspecific(thread_object_key); } + assert(nil != thr && @"No main thread"); return thr; }