mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Revert an nsthread change and try to avoid memory leaks when autorelease
pools are created during the thread exit process. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20287 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e7fd84dbae
commit
d2161f1c01
3 changed files with 11 additions and 4 deletions
|
@ -264,7 +264,7 @@ GSCurrentThread(void)
|
|||
|
||||
/**
|
||||
* Fast access function for thread dictionary of current thread.<br />
|
||||
* If there is no dictionary, and the thread is active, creates the dictionary.
|
||||
* If there is no dictionary, creates the dictionary.
|
||||
*/
|
||||
NSMutableDictionary*
|
||||
GSDictionaryForThread(NSThread *t)
|
||||
|
@ -281,7 +281,7 @@ GSDictionaryForThread(NSThread *t)
|
|||
{
|
||||
NSMutableDictionary *dict = t->_thread_dictionary;
|
||||
|
||||
if (dict == nil && ((NSThread_ivars *)t)->_active == YES)
|
||||
if (dict == nil)
|
||||
{
|
||||
dict = [t threadDictionary];
|
||||
}
|
||||
|
@ -514,6 +514,7 @@ gnustep_base_thread_callback(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Terminating a thread
|
||||
* What happens if the thread doesn't call +exit - it doesn't terminate!
|
||||
|
@ -666,12 +667,10 @@ gnustep_base_thread_callback(void)
|
|||
/*
|
||||
* Try again to get rid of thread dictionary.
|
||||
*/
|
||||
init_autorelease_thread_vars(&_autorelease_vars);
|
||||
DESTROY(_thread_dictionary);
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
if (_thread_dictionary != nil)
|
||||
{
|
||||
init_autorelease_thread_vars(&_autorelease_vars);
|
||||
NSLog(@"Oops - leak - thread dictionary is %@", _thread_dictionary);
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue