mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 12:16:40 +00:00
Thread deallocation fix ... retry deallocation of dictionary if it gets
re-used during thread deallocation. If it still persists, leak memory and log the problem. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9425 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
839fc8a5a9
commit
161e75b1e3
3 changed files with 22 additions and 3 deletions
|
@ -329,12 +329,26 @@ gnustep_base_thread_callback()
|
|||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Deallocating an active thread without [+exit]!"];
|
||||
}
|
||||
_deallocating = YES;
|
||||
DESTROY(_thread_dictionary);
|
||||
DESTROY(_target);
|
||||
DESTROY(_arg);
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
|
||||
if (_thread_dictionary != nil)
|
||||
{
|
||||
/*
|
||||
* 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];
|
||||
}
|
||||
}
|
||||
NSDeallocateObject(self);
|
||||
}
|
||||
|
||||
|
@ -395,7 +409,7 @@ gnustep_base_thread_callback()
|
|||
*/
|
||||
- (NSMutableDictionary*) threadDictionary
|
||||
{
|
||||
if (_thread_dictionary == nil && _deallocating == NO)
|
||||
if (_thread_dictionary == nil)
|
||||
{
|
||||
_thread_dictionary = [NSMutableDictionary new];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue