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> 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 * Source/NSWindow.m: Don't log DnD stuff unless NSDragging logging

View file

@ -201,14 +201,15 @@
externalNameTable: (NSDictionary *)context externalNameTable: (NSDictionary *)context
withZone: (NSZone *)zone withZone: (NSZone *)zone
{ {
NSData *data;
BOOL loaded = NO; BOOL loaded = NO;
NSUnarchiver *unarchiver = nil;
NS_DURING
{
NSData *data = [NSData dataWithContentsOfFile: fileName];
data = [NSData dataWithContentsOfFile: fileName];
if (data != nil) if (data != nil)
{ {
NSUnarchiver *unarchiver;
unarchiver = [[NSUnarchiver alloc] initForReadingWithData: data]; unarchiver = [[NSUnarchiver alloc] initForReadingWithData: data];
if (unarchiver != nil) if (unarchiver != nil)
{ {
@ -222,9 +223,9 @@
{ {
[obj awakeWithContext: context]; [obj awakeWithContext: context];
/* /*
* Ok - it's all done now - just retain the nib container *Ok - it's all done now - just retain the nib container
* so tthat it will not be released when the unarchiver *so that it will not be released when the unarchiver
* is released, and the nib contents will persist. *is released, and the nib contents will persist.
*/ */
RETAIN(obj); RETAIN(obj);
loaded = YES; loaded = YES;
@ -237,6 +238,12 @@
RELEASE(unarchiver); RELEASE(unarchiver);
} }
} }
}
NS_HANDLER
{
TEST_RELEASE(unarchiver);
}
NS_ENDHANDLER
return loaded; return loaded;
} }