Tweaks for leack checking at exit

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37008 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-08-22 19:55:03 +00:00
parent ed09c55959
commit 4381b10267
3 changed files with 33 additions and 14 deletions

View file

@ -1827,7 +1827,10 @@ IF_NO_GC(
NSString *path;
[load_lock lock];
NSMapRemove(_bundles, _path);
if (_bundles != nil)
{
NSMapRemove(_bundles, _path);
}
if (identifier != nil)
{
NSMapRemove(_byIdentifier, identifier);
@ -1836,12 +1839,15 @@ IF_NO_GC(
{
NSMapRemove(_byClass, _principalClass);
}
count = [_bundleClasses count];
while (count-- > 0)
{
NSMapRemove(_byClass,
[[_bundleClasses objectAtIndex: count] pointerValue]);
}
if (_byClass != nil)
{
count = [_bundleClasses count];
while (count-- > 0)
{
NSMapRemove(_byClass,
[[_bundleClasses objectAtIndex: count] pointerValue]);
}
}
[load_lock unlock];
/* Clean up path cache for this bundle.

View file

@ -127,9 +127,15 @@ static NSIndexPath *dummy = nil;
if (self != empty)
{
[lock lock];
NSHashRemove(shared, self);
if (shared != nil)
{
NSHashRemove(shared, self);
}
[lock unlock];
NSZoneFree(NSDefaultMallocZone(), _indexes);
if (_indexes != 0)
{
NSZoneFree(NSDefaultMallocZone(), _indexes);
}
[super dealloc];
}
GSNOSUPERDEALLOC;
@ -160,7 +166,8 @@ static NSIndexPath *dummy = nil;
[aCoder encodeInt: (NSInteger)_length forKey: @"NSIndexPathLength"];
if (_length == 1)
{
[aCoder encodeInt: (NSInteger)_indexes[0] forKey: @"NSIndexPathValue"];
[aCoder encodeInt: (NSInteger)_indexes[0]
forKey: @"NSIndexPathValue"];
}
else if (_length > 1)
{
@ -317,8 +324,7 @@ static NSIndexPath *dummy = nil;
[aCoder decodeValueOfObjCType: @encode(NSUInteger) at: &length];
if (length == 0)
{
DESTROY(self);
self = empty;
ASSIGN(self, empty);
}
else
{
@ -378,6 +384,7 @@ static NSIndexPath *dummy = nil;
{
if (self == empty)
{
RELEASE(self);
self = (NSIndexPath*)NSAllocateObject([self class],
0, NSDefaultMallocZone());
}
@ -390,9 +397,9 @@ static NSIndexPath *dummy = nil;
}
else
{
DESTROY(self);
self = RETAIN(found);
ASSIGN(self, found);
}
dummy->_indexes = 0; // Don't want static indexes deallocated atExit
[lock unlock];
return self;
}

View file

@ -1357,6 +1357,12 @@ static NSMapTable *absolutes = 0;
zone_mutex = [GSLazyRecursiveLock new];
[[NSObject leakAt: (id*)&zone_mutex] release];
[[NSObject leakAt: (id*)&defaultTimeZone] release];
[[NSObject leakAt: (id*)&systemTimeZone] release];
[[NSObject leakAt: (id*)&abbreviationDictionary] release];
[[NSObject leakAt: (id*)&abbreviationMap] release];
[[NSObject leakAt: (id*)&absolutes] release];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(_notified:)
name: NSUserDefaultsDidChangeNotification