Add check and exception for repeated deallocation of a pool.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39706 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2016-04-28 20:35:00 +00:00
parent c07552ab0f
commit 9487a93286
2 changed files with 22 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2016-04-28 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSAutoreleasePool.m:
Check for a pool being deallocated when it has already been
deallocated (and raise an exception).
2016-04-23 Marcus Mueller <znek@mulle-kybernetik.com>
* Source/GSAvahiNetService.m: Avahi-based NSNetServices did crash
@ -6,12 +12,12 @@
2016-04-08 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m
* Source/NSUserDefaults.m:
Remove redundant code. Log domain names when debug is enabled.
2016-04-08 Riccardo Mottola <rm@gnu.org>
* Source/NSUserDefaults.m
* Source/NSUserDefaults.m:
Skip nil domains explicitely and do not use nil values to look them up.
2016-04-04 Niels Grewe <niels.grewe@halbordnung.de>

View file

@ -295,9 +295,14 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
+ (id) allocWithZone: (NSZone*)zone
{
struct autorelease_thread_vars *tv = ARP_THREAD_VARS;
if (tv->pool_cache_count)
return pop_pool_from_cache (tv);
if (tv->pool_cache_count)
{
NSAutoreleasePool *p = pop_pool_from_cache (tv);
NSAssert(++(p->_released_count) == 0, @"corrupted pool in cache");
return p;
}
return NSAllocateObject (self, 0, zone);
}
@ -720,6 +725,13 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv)
_parent = nil;
}
if (_released_count-- != 0)
{
_released_count++;
[NSException raise: NSInternalInconsistencyException
format: @"NSAutoreleasePool -dealloc of deallocated pool"];
}
/* Don't deallocate ourself, just save us for later use. */
push_pool_to_cache (tv, self);
GSNOSUPERDEALLOC;