diff --git a/NSTimeZones/NSTimeZones.tar b/NSTimeZones/NSTimeZones.tar index 2e0df8bb7..6633d5cd0 100644 Binary files a/NSTimeZones/NSTimeZones.tar and b/NSTimeZones/NSTimeZones.tar differ diff --git a/Source/Additions/NSObject+GNUstepBase.m b/Source/Additions/NSObject+GNUstepBase.m index 05753a705..590e6a473 100644 --- a/Source/Additions/NSObject+GNUstepBase.m +++ b/Source/Additions/NSObject+GNUstepBase.m @@ -541,8 +541,8 @@ + (BOOL) shouldCleanUp } GS_MUTEX_UNLOCK(trackLock); fprintf(stderr, "Tracking ownership - unable to find entry for" - " instance %p of '%s'\n", o, class_getName(c)); - NSLog(@"Tracking ownership %p problem at %s", + " instance %p of '%s'.\n", o, class_getName(c)); + fprintf(stderr, "Tracking ownership %p problem at %s.\n", o, stackTrace(1)); /* Should never happen because we don't remove class entries, but I suppose @@ -598,7 +598,7 @@ - (void) _replacementDealloc } } GS_MUTEX_UNLOCK(trackLock); - NSLog(@"Tracking ownership -[%p dealloc] at %s", + fprintf(stderr, "Tracking ownership -[%p dealloc] at %s.\n", self, stackTrace(2)); (*dealloc)(self, _cmd); } @@ -620,7 +620,7 @@ - (void) _replacementRelease unsigned rc; rc = (unsigned)[self retainCount]; - NSLog(@"Tracking ownership -[%p release] %u->%u at %s", + fprintf(stderr, "Tracking ownership -[%p release] %u->%u at %s.\n", self, rc, rc-1, stackTrace(2)); (*release)(self, _cmd); } @@ -644,7 +644,7 @@ - (id) _replacementRetain rc = (unsigned)[self retainCount]; result = (*retain)(self, _cmd); - NSLog(@"Tracking ownership -[%p retain] %u->%u at %s", + fprintf(stderr, "Tracking ownership -[%p retain] %u->%u at %s.\n", self, rc, (unsigned)[self retainCount], stackTrace(2)); } return result; @@ -755,7 +755,7 @@ + (void) trackOwnership l->next = tracked; tracked = l; GS_MUTEX_UNLOCK(trackLock); - NSLog(@"Tracking ownership started for class %p at %s", + fprintf(stderr, "Tracking ownership started for class %p at %s.\n", self, stackTrace(1)); } @@ -823,7 +823,7 @@ - (void) trackOwnership li->next = tracked; tracked = li; GS_MUTEX_UNLOCK(trackLock); - NSLog(@"Tracking ownership started for instance %p at %s", + fprintf(stderr, "Tracking ownership started for instance %p at %s.\n", self, stackTrace(1)); } diff --git a/Source/NSPropertyList.m b/Source/NSPropertyList.m index 43b31cfcb..3d418d92e 100644 --- a/Source/NSPropertyList.m +++ b/Source/NSPropertyList.m @@ -2379,30 +2379,46 @@ @implementation NSPropertyListSerialization + (void) initialize { - if (classInitialized == NO) - { - NSMutableCharacterSet *s; + NSMutableCharacterSet *s; - classInitialized = YES; - - NSStringClass = [NSString class]; - NSMutableStringClass = [NSMutableString class]; - NSDataClass = [NSData class]; - NSDateClass = [NSDate class]; - NSNumberClass = [NSNumber class]; - NSArrayClass = [NSArray class]; - NSDictionaryClass = [NSDictionary class]; - GSStringClass = [GSString class]; - GSMutableStringClass = [GSMutableString class]; + if (Nil == NSStringClass) NSStringClass = [NSString class]; + if (Nil == GSStringClass) GSStringClass = [GSString class]; + if (Nil == NSMutableStringClass) + NSMutableStringClass = [NSMutableString class]; + if (Nil == GSMutableStringClass) + GSMutableStringClass = [GSMutableString class]; + if (Nil == NSArrayClass) NSArrayClass = [NSArray class]; + if (Nil == plArray) + { plArray = [GSMutableArray class]; plAdd = (id (*)(id, SEL, id)) [plArray instanceMethodForSelector: @selector(addObject:)]; + } + if (Nil == NSDictionaryClass) NSDictionaryClass = [NSDictionary class]; + if (Nil == plDictionary) + { plDictionary = [GSMutableDictionary class]; plSet = (id (*)(id, SEL, id, id)) [plDictionary instanceMethodForSelector: @selector(setObject:forKey:)]; + } + + if (Nil == NSDataClass) NSDataClass = [NSData class]; + if (Nil == NSNumberClass) NSNumberClass = [NSNumber class]; + if (nil == boolN) + { + boolN = [[NSNumber numberWithBool: NO] retain]; + [[NSObject leakAt: &boolN] release]; + } + if (nil == boolY) + { + boolY = [[NSNumber numberWithBool: YES] retain]; + [[NSObject leakAt: &boolY] release]; + } + if (nil == oldQuotables) + { /* The '$', '.', '/' and '_' characters used to be OK to use in * property lists, but OSX now quotes them, so we follow suite. */ @@ -2413,7 +2429,10 @@ + (void) initialize [s invert]; oldQuotables = s; [[NSObject leakAt: &oldQuotables] release]; + } + if (nil == xmlQuotables) + { s = [NSMutableCharacterSet new]; [s addCharactersInString: @"&<>'\\\""]; [s addCharactersInRange: NSMakeRange(0x0001, 0x001f)]; @@ -2423,13 +2442,17 @@ + (void) initialize [s addCharactersInRange: NSMakeRange(0xFFFE, 0x0002)]; xmlQuotables = s; [[NSObject leakAt: &xmlQuotables] release]; + } - boolN = [[NSNumber numberWithBool: NO] retain]; - [[NSObject leakAt: &boolN] release]; - - boolY = [[NSNumber numberWithBool: YES] retain]; - [[NSObject leakAt: &boolY] release]; + /* Initialize the date class last as it has external dependencies on + * time zone data. + */ + if (Nil == NSDateClass) + { + NSDateClass = [NSDate class]; } + + classInitialized = YES; } + (NSData*) dataFromPropertyList: (id)aPropertyList diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index b509a9c78..6eea6fd01 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -1288,7 +1288,6 @@ + (void) atExit GS_MUTEX_UNLOCK(zone_mutex); DESTROY(zoneDictionary); - DESTROY(localTimeZone); DESTROY(defaultTimeZone); DESTROY(systemTimeZone); DESTROY(abbreviationDictionary); @@ -1346,6 +1345,10 @@ + (void) initialize absolutes = NSCreateMapTable(NSIntegerMapKeyCallBacks, NSNonOwnedPointerMapValueCallBacks, 0); + /* NB. the instance of NSLocalTimeZone overrides memory management + * so it is never deallocated. This must not be destroyed in the + * +atExit: method becuse that would confuse leak analysis tools. + */ localTimeZone = [[NSLocalTimeZone alloc] init]; [[NSNotificationCenter defaultCenter] addObserver: self