Fixed -emptyPool ARC_RUNTIME implementation not to push a pool to the cache,

-dealloc does it already.

The previous implementation could result in a pool being reused while still in 
use. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35795 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Quentin Mathe 2012-11-15 16:34:54 +00:00
parent a1843ff254
commit a396bc9f22
2 changed files with 15 additions and 6 deletions

View file

@ -1,3 +1,12 @@
2012-11-15 Quentin Mathe <quentin.mathe@gmail.com>
* Source/NSAutoreleasePool.m (-emptyPool): Fixed not to push a pool to
the cache in the ARC_RUNTIME implementation, -dealloc does it already.
For the same current pool instance, the ARC_RUNTIME implementation was
calling push_pool_to_cache() twice, once in -emptyPool and another
-dealloc. Which meant a pool still in use could be reused, then it was
possible to get stuck in an infinite loop.
2012-11-05 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/GSFFIInvocation.m (GSFFIInvocationCallback): Generate

View file

@ -369,6 +369,12 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
format: @"Too many (%u) autorelease pools ... leaking them?", level];
}
}
/* Catch the case where the receiver is a pool still in use (wrongly put in
the pool cache previously). */
NSCAssert(_child != self, @"Invalid child pool");
NSCAssert(_parent != self, @"Invalid parent pool");
return self;
}
@ -401,12 +407,6 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
- (void) emptyPool
{
struct autorelease_thread_vars *tv = ARP_THREAD_VARS;
while (_child)
{
NSAutoreleasePool *pool = _child;
_child = pool->_child;
push_pool_to_cache(tv, pool);
}
tv->current_pool = self;
objc_autoreleasePoolPop(_released);
}