Small improvements to NIB loading.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30010 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2010-03-20 17:23:10 +00:00
parent 1399765d96
commit 05beafea2e
4 changed files with 31 additions and 13 deletions

View file

@ -1,3 +1,14 @@
2010-03-20 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-buildUpTextNetwork:): Prevent retain cycle
by storing reference to retained text storage in ivar.
* gui/Source/GSNibLoader.m
(-loadModelData:externalNameTable:withZone:): Use an auto release
pool while loading a NIB file.
* gui/Source/GSNibLoading.m
(NSKeyedUnarchiver-replacementClassForClassName:): Check for class
level replacement as well.
2010-03-20 Fred Kiefer <FredKiefer@gmx.de>
* gui/Headers/AppKit/NSNib.h,

View file

@ -28,6 +28,7 @@
#import "config.h"
#import <Foundation/NSArchiver.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDebug.h>
#import <Foundation/NSDictionary.h>
@ -62,14 +63,14 @@
externalNameTable: (NSDictionary *)context
withZone: (NSZone *)zone;
{
BOOL loaded = NO;
NSUnarchiver *unarchiver = nil;
BOOL loaded = NO;
CREATE_AUTORELEASE_POOL(pool);
NS_DURING
{
if (data != nil)
{
unarchiver = [[NSKeyedUnarchiver alloc]
NSUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc]
initForReadingWithData: data];
if (unarchiver != nil)
{
@ -119,6 +120,7 @@
NSLog(@"Failed to load Nib\n");
}
RELEASE(pool);
return loaded;
}

View file

@ -1289,12 +1289,15 @@ static BOOL _isInInterfaceBuilder = NO;
Class aClass;
if ((aClass = [self classForClassName: className]) == nil)
{
aClass = NSClassFromString(className);
}
if (aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"NSClassSwapper unable to find class '%@'", className];
if ((aClass = [[self class] classForClassName: className]) == nil)
{
aClass = NSClassFromString(className);
if (aClass == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"NSClassSwapper unable to find class '%@'", className];
}
}
}
return aClass;
}

View file

@ -660,16 +660,18 @@ If a text view is added to an empty text network, it keeps its attributes.
[layoutManager addTextContainer: textContainer];
RELEASE(textContainer);
/* We keep a flag to remember that we are directly responsible for
managing the text network. */
_tf.owns_text_network = YES;
// This value gets set once more in setTextContainer: to the same value.
_textStorage = textStorage;
/* The situation at this point is as follows:
textView (us) --RETAINs--> textStorage
textStorage --RETAINs--> layoutManager
layoutManager --RETAINs--> textContainer */
/* We keep a flag to remember that we are directly responsible for
managing the text network. */
_tf.owns_text_network = YES;
return textContainer;
}