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:
FredKiefer 2005-04-07 22:13:10 +00:00
parent 3c1963e1a3
commit 06956fd6c1
2 changed files with 12 additions and 4 deletions

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];