From 530dee1e2fa9df6faa76fbc2577e4be082854f0f Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Thu, 29 Aug 2024 16:16:43 -0400 Subject: [PATCH] Minor fix in NSNib to use NULL, quick fix in NSBundleAdditions to fix issue with model not returning top-level objects --- ChangeLog | 5 +++++ Source/NSBundleAdditions.m | 26 ++++++++++++++++++++++++-- Source/NSNib.m | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5294165cda..820b925df4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-08-29 Gregory John Casamento + + * Source/NSBundleAdditions.m: Quick fix for .gorm loading + not returning top level objects. + 2024-08-18 Gregory John Casamento * Headers/AppKit/NSTreeController.h: Update header diff --git a/Source/NSBundleAdditions.m b/Source/NSBundleAdditions.m index ea1b189e36..f4c5ff877a 100644 --- a/Source/NSBundleAdditions.m +++ b/Source/NSBundleAdditions.m @@ -165,8 +165,30 @@ - (BOOL) loadNibNamed: (NSString *)aNibName if (owner != nil && aNibName != nil) { - NSDictionary *table = [NSDictionary dictionaryWithObject: owner forKey: NSNibOwner]; - + NSDictionary *table = nil; + NSMutableArray *tlo = nil; + + // Based on the arguments above, set up the table appropriately... + if (owner != nil) + { + if (topLevelObjects != NULL) + { + // Here we initialize the array, it is sent in using the dictionary. + // In the code below it is pulled back out and assigned to the + // reference in the arguments. + tlo = [NSMutableArray array]; + table = [NSDictionary dictionaryWithObjectsAndKeys: + owner, NSNibOwner, + tlo, NSNibTopLevelObjects, + nil]; + } + else + { + table = [NSDictionary dictionaryWithObject: owner forKey: NSNibOwner]; + } + } + + // Attempt to load the model file... success = [self loadNibFile: aNibName externalNameTable: table withZone: [owner zone]]; diff --git a/Source/NSNib.m b/Source/NSNib.m index f636ab4b70..398a6fdbb5 100644 --- a/Source/NSNib.m +++ b/Source/NSNib.m @@ -209,7 +209,7 @@ - (BOOL) instantiateNibWithOwner: (id)owner // add the necessary things to the table... [externalNameTable setObject: owner forKey: NSNibOwner]; - if (topLevelObjects != 0) + if (topLevelObjects != NULL) { *topLevelObjects = [NSMutableArray array]; [externalNameTable setObject: *topLevelObjects