mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Moved registration of runtime multithreaded handler to after the creation of the main thread's NSThread object. This fixes a potential issue where the runtime is already in multithreaded mode, calls the handler, and NSException crashes dereferencing the thread object.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28609 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0aa15f423c
commit
29faf077e7
1 changed files with 8 additions and 7 deletions
|
@ -485,13 +485,6 @@ static NSThread *defaultThread;
|
|||
{
|
||||
if (self == [NSThread class])
|
||||
{
|
||||
/*
|
||||
* The objc runtime calls this callback AFTER creating a new thread -
|
||||
* which is not correct for us, but does at least mean that we can tell
|
||||
* if we have become multi-threaded due to a call to the runtime directly
|
||||
* rather than via the NSThread class.
|
||||
*/
|
||||
objc_set_thread_callback(gnustep_base_thread_callback);
|
||||
|
||||
if (pthread_key_create(&thread_object_key, releaseThread))
|
||||
{
|
||||
|
@ -505,6 +498,14 @@ static NSThread *defaultThread;
|
|||
threadClass = self;
|
||||
[NSThread _createThreadForCurrentPthread];
|
||||
defaultThread = [NSThread currentThread];
|
||||
|
||||
/*
|
||||
* The objc runtime calls this callback AFTER creating a new thread -
|
||||
* which is not correct for us, but does at least mean that we can tell
|
||||
* if we have become multi-threaded due to a call to the runtime directly
|
||||
* rather than via the NSThread class.
|
||||
*/
|
||||
objc_set_thread_callback(gnustep_base_thread_callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue