From 1d473e573aba2e5090c21ddde5cb65db85232fcb Mon Sep 17 00:00:00 2001 From: rfm Date: Sat, 22 Jun 2024 15:19:13 +0100 Subject: [PATCH] Another memory management tweak. --- Tools/autogsdoc.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m index 15992c7b3..da2860066 100644 --- a/Tools/autogsdoc.m +++ b/Tools/autogsdoc.m @@ -623,6 +623,7 @@ standard PropertyList format (not the XML format of OS X), using { NSProcessInfo *proc; unsigned i; + NSMutableDictionary *safe; NSDictionary *argsRecognized; NSUserDefaults *defs; NSFileManager *mgr; @@ -728,6 +729,11 @@ standard PropertyList format (not the XML format of OS X), using outer = [NSAutoreleasePool new]; + /* Objects we want to persist until the outer autorelease pool is exited + * can be stored in the 'safe; dictionary. + */ + safe = [NSMutableDictionary dictionary]; + #ifndef HAVE_LIBXML NSLog(@"ERROR: The GNUstep Base Library was built\n" @" without an available libxml library. Autogsdoc needs the libxml\n" @@ -897,6 +903,7 @@ standard PropertyList format (not the XML format of OS X), using declared = [defs stringForKey: @"Declared"]; project = [defs stringForKey: @"Project"]; refsName = [project stringByAppendingPathExtension: @"igsdoc"]; + [safe setObject: refsName forKey: @"refsName"]; headerDirectory = [defs stringForKey: @"HeaderDirectory"]; if (headerDirectory == nil) @@ -1006,6 +1013,7 @@ standard PropertyList format (not the XML format of OS X), using stringByAppendingPathComponent: project]; refsFile = [refsFile stringByAppendingPathExtension: @"igsdoc"]; projectRefs = AUTORELEASE([AGSIndex new]); + [safe setObject: projectRefs forKey: @"projectRefs"]; originalIndex = nil; rDate = [NSDate distantPast]; if ([mgr isReadableFileAtPath: refsFile] == YES) @@ -1020,6 +1028,7 @@ standard PropertyList format (not the XML format of OS X), using { NSDictionary *dict; + [safe setObject: originalIndex forKey: @"originalIndex"]; [projectRefs mergeRefs: originalIndex override: NO]; if (verbose) { @@ -1730,11 +1739,12 @@ standard PropertyList format (not the XML format of OS X), using NSLog(@"Sorry unable to write %@", refsFile); } } - DESTROY(originalIndex); + originalIndex = nil; DESTROY(merged); } globalRefs = AUTORELEASE([AGSIndex new]); + [safe setObject: globalRefs forKey: @"globalRefs"]; /* * 8) If we are either generating html output, or relocating existing