Correct retain/release issues in NSScrollView and NSWindowController.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26799 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2008-08-02 17:34:04 +00:00
parent 99fc2cf864
commit fb69a9fd22
3 changed files with 25 additions and 11 deletions

View file

@ -1,3 +1,10 @@
2008-08-02 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSScrollView.m (-initWithCoder:): Handle non-retained
ivars correctly.
* Source/NSWindowController.m (-loadWindow): Release the loaded
window once, as it got retained by the NIB loading mechanism.
2008-07-13 Fred Kiefer <FredKiefer@gmx.de> 2008-07-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSGlyphGenerator.m (-generateGlyphsForGlyphStorage:...): * Source/NSGlyphGenerator.m (-generateGlyphsForGlyphStorage:...):

View file

@ -254,6 +254,14 @@ static float scrollerWidth;
{ {
_contentView = nil; _contentView = nil;
} }
if (aView == _headerClipView)
{
_headerClipView = nil;
}
if (aView == _cornerView)
{
_cornerView = nil;
}
[super removeSubview: aView]; [super removeSubview: aView];
} }
@ -1511,12 +1519,7 @@ static float scrollerWidth;
[content setFrame: frame]; [content setFrame: frame];
} }
// FIXME: No idea what is going on here.
// retain the view and reset the content view...
RETAIN(content);
[self setContentView: content]; [self setContentView: content];
RELEASE(content);
ASSIGN(_contentView, content);
} }
if (hScroller != nil && _hasHorizScroller) if (hScroller != nil && _hasHorizScroller)
@ -1533,8 +1536,7 @@ static float scrollerWidth;
{ {
_hasHeaderView = YES; _hasHeaderView = YES;
_hasCornerView = YES; _hasCornerView = YES;
ASSIGN(_headerClipView, _headerClipView = [aDecoder decodeObjectForKey: @"NSHeaderClipView"];
[aDecoder decodeObjectForKey: @"NSHeaderClipView"]);
} }
[self tile]; [self tile];
@ -1543,7 +1545,7 @@ static float scrollerWidth;
{ {
int version = [aDecoder versionForClassName: @"NSScrollView"]; int version = [aDecoder versionForClassName: @"NSScrollView"];
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n"); NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
[aDecoder decodeValueOfObjCType: @encode(id) at: &_contentView]; _contentView = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType]; [aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
@ -1572,7 +1574,7 @@ static float scrollerWidth;
{ {
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasHeaderView];
if (_hasHeaderView) if (_hasHeaderView)
[aDecoder decodeValueOfObjCType: @encode(id) at: &_headerClipView]; _headerClipView = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_hasCornerView];
} }

View file

@ -446,6 +446,11 @@
{ {
[self setWindow: [_document _transferWindowOwnership]]; [self setWindow: [_document _transferWindowOwnership]];
} }
else
{
// The window was already retained by the NIB loading.
RELEASE(_window);
}
} }
else else
{ {