Prevent exception when subview is added at the end of the subview list.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@21073 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2005-04-07 22:13:10 +00:00
parent 7036061d5d
commit daa83e855e
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2005-04-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSView.m (-addSubview:positioned:relativeTo:): Don't
increase index for subview added at the end. Based on patch by
Matthias Hengartner <hengartner@ivt.baug.ethz.ch>.
2005-04-03 14:53 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSCustomImageRep.m: Allow drawing if the delegate is

View file

@ -474,6 +474,11 @@ GSSetDragTypes(NSView* obj, NSArray *types)
else
index = [_sub_views count];
}
else if (place != NSWindowBelow)
{
index += 1;
}
RETAIN(aView);
[aView removeFromSuperview];
if (aView->_coordinates_valid)
@ -483,10 +488,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
[aView viewWillMoveToWindow: _window];
[aView viewWillMoveToSuperview: self];
[aView setNextResponder: self];
if (place == NSWindowBelow)
[_sub_views insertObject: aView atIndex: index];
else
[_sub_views insertObject: aView atIndex: index+1];
[_sub_views insertObject: aView atIndex: index];
_rFlags.has_subviews = 1;
[aView resetCursorRects];
[aView setNeedsDisplay: YES];