Minor fix for loading nibs

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5795 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-01-17 07:18:42 +00:00
parent fff420f2ef
commit e52de6929e
2 changed files with 37 additions and 25 deletions

View file

@ -1,3 +1,8 @@
Mon Jan 17 6:32:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSBundleAdditions.m: Catch exceptions when loading nib so
we simply return YES or NO. Fix suggested by karl@nfox.com
Sun Jan 16 8:57:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSWindow.m: Don't log DnD stuff unless NSDragging logging

View file

@ -201,42 +201,49 @@
externalNameTable: (NSDictionary *)context
withZone: (NSZone *)zone
{
NSData *data;
BOOL loaded = NO;
NSUnarchiver *unarchiver = nil;
data = [NSData dataWithContentsOfFile: fileName];
if (data != nil)
NS_DURING
{
NSUnarchiver *unarchiver;
NSData *data = [NSData dataWithContentsOfFile: fileName];
unarchiver = [[NSUnarchiver alloc] initForReadingWithData: data];
if (unarchiver != nil)
if (data != nil)
{
id obj;
[unarchiver setObjectZone: zone];
obj = [unarchiver decodeObject];
if (obj != nil)
unarchiver = [[NSUnarchiver alloc] initForReadingWithData: data];
if (unarchiver != nil)
{
if ([obj isKindOfClass: [GSNibContainer class]])
id obj;
[unarchiver setObjectZone: zone];
obj = [unarchiver decodeObject];
if (obj != nil)
{
[obj awakeWithContext: context];
/*
* Ok - it's all done now - just retain the nib container
* so tthat it will not be released when the unarchiver
* is released, and the nib contents will persist.
*/
RETAIN(obj);
loaded = YES;
}
else
{
NSLog(@"Nib '%@' without container object!", fileName);
if ([obj isKindOfClass: [GSNibContainer class]])
{
[obj awakeWithContext: context];
/*
*Ok - it's all done now - just retain the nib container
*so that it will not be released when the unarchiver
*is released, and the nib contents will persist.
*/
RETAIN(obj);
loaded = YES;
}
else
{
NSLog(@"Nib '%@' without container object!", fileName);
}
}
RELEASE(unarchiver);
}
RELEASE(unarchiver);
}
}
NS_HANDLER
{
TEST_RELEASE(unarchiver);
}
NS_ENDHANDLER
return loaded;
}