Fix XIB loading bug reported by Julian Mayer as bug #34454.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33931 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2011-10-03 12:48:15 +00:00
parent e9f1eff154
commit 23b1ff3f36
4 changed files with 56 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2011-10-03 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (-initWithCoder:): Don't decode super view.
* Headers/Additions/GNUstepGUI/GSXibLoading.h: Add class IBBindingConnection.
* Source/GSXibLoader.m: Implement IBBindingConnection.
* Source/GSXibLoader.m (-objectForXib:): Return a previously
decoded object instead of a new one if available.
2011-10-01 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMenuView.m (-_trackWithEvent:startingMenuView:,

View file

@ -84,6 +84,12 @@
}
@end
@interface IBBindingConnection: IBConnection
{
NSNibBindingConnector *connector;
}
@end
@interface IBConnectionRecord: NSObject
{
IBConnection *connection;

View file

@ -288,6 +288,35 @@
@end
@implementation IBBindingConnection
- (void) dealloc
{
DESTROY(connector);
[super dealloc];
}
- (id) initWithCoder: (NSCoder*)coder
{
self = [super initWithCoder: coder];
if ([coder allowsKeyedCoding])
{
if ([coder containsValueForKey: @"connector"])
{
ASSIGN(connector, [coder decodeObjectForKey: @"connector"]);
}
}
return self;
}
- (void) establishConnection
{
[connector establishConnection];
}
@end
@implementation IBConnectionRecord
- (id) initWithCoder: (NSCoder*)coder
@ -892,6 +921,16 @@ didStartElement: (NSString *)elementName
NSDebugLLog(@"XIB", @"decoding element %@", element);
key = [element attributeForKey: @"id"];
if (key != nil)
{
id new = [decoded objectForKey: key];
if (new != nil)
{
// The object was already decoded as a reference
return new;
}
}
elementName = [element type];
if ([@"object" isEqualToString: elementName])
{

View file

@ -4697,8 +4697,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
NSInternalInconsistencyException);
NSAssert([sub window] == nil,
NSInternalInconsistencyException);
NSAssert([sub superview] == nil,
NSInternalInconsistencyException);
NSAssert([sub superview] == nil,
NSInternalInconsistencyException);
[sub _viewWillMoveToWindow: _window];
[sub _viewWillMoveToSuperview: self];
[sub setNextResponder: self];
@ -4712,7 +4712,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
}
// the superview...
[aDecoder decodeObjectForKey: @"NSSuperview"];
//[aDecoder decodeObjectForKey: @"NSSuperview"];
}
else
{