Author: rfm
Date: Sat Feb 14 06:50:48 2015
New Revision: 38340
URL: http://svn.gna.org/viewcvs/gnustep?rev=38340&view=rev
Log:
fix for bug # 44240
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/NSThread.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=38340&r1=38339&r2=38340&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Sat Feb 14 06:50:48 2015
@@ -1,3 +1,10 @@
+2015-02-14 Richard Frith-Macdonald <[email protected]>
+
+ * Source/NSThread.m: Be more agressive about releasing thread
+ resources when a thread exists (in particular release the
+ thread's runloop repeatedly for bug #44240) in case of the
+ deallocation of objects causing re-population of thread data.
+
2015-02-07 Richard Frith-Macdonald <[email protected]>
* Source/NSData.m: Simplify mingw/unixy ifdefs for writing a file.
Modified: libs/base/trunk/Source/NSThread.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSThread.m?rev=38340&r1=38339&r2=38340&view=diff
==============================================================================
--- libs/base/trunk/Source/NSThread.m (original)
+++ libs/base/trunk/Source/NSThread.m Sat Feb 14 06:50:48 2015
@@ -710,18 +710,14 @@
- (void) dealloc
{
+ int retries = 0;
+
if (_active == YES)
{
[NSException raise: NSInternalInconsistencyException
format: @"Deallocating an active thread without [+exit]!"];
}
- if (_runLoopInfo != 0)
- {
- GSRunLoopThreadInfo *info = (GSRunLoopThreadInfo*)_runLoopInfo;
-
- _runLoopInfo = 0;
- [info release];
- }
+ DESTROY(_runLoopInfo);
DESTROY(_thread_dictionary);
DESTROY(_target);
DESTROY(_arg);
@@ -731,24 +727,33 @@
[NSAutoreleasePool _endThread: self];
}
- if (_thread_dictionary != nil)
- {
- /*
- * Try again to get rid of thread dictionary.
+ while ((_thread_dictionary != nil || _runLoopInfo != nil) && retries++ < 10)
+ {
+ /* Try again.
*/
+ DESTROY(_runLoopInfo);
DESTROY(_thread_dictionary);
if (_autorelease_vars.pool_cache != 0)
{
[NSAutoreleasePool _endThread: self];
}
- if (_thread_dictionary != nil)
- {
- NSLog(@"Oops - leak - thread dictionary is %@", _thread_dictionary);
- if (_autorelease_vars.pool_cache != 0)
- {
- [NSAutoreleasePool _endThread: self];
- }
- }
+ }
+
+ if (_runLoopInfo != nil)
+ {
+ NSLog(@"Oops - leak - run loop is %@", _runLoopInfo);
+ if (_autorelease_vars.pool_cache != 0)
+ {
+ [NSAutoreleasePool _endThread: self];
+ }
+ }
+ if (_thread_dictionary != nil)
+ {
+ NSLog(@"Oops - leak - thread dictionary is %@", _thread_dictionary);
+ if (_autorelease_vars.pool_cache != 0)
+ {
+ [NSAutoreleasePool _endThread: self];
+ }
}
DESTROY(_gcontext);
[super dealloc];
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs