diff --git a/ChangeLog b/ChangeLog index 5294165cd..820b925df 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 ea1b189e3..f4c5ff877 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 f636ab4b7..398a6fdbb 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