Minor bugfix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5596 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-12-21 15:32:20 +00:00
parent 86882fc677
commit ab48c495ec
3 changed files with 22 additions and 18 deletions

View file

@ -1,3 +1,9 @@
Mon Dec 20 15:28:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSView.m: Fix removal of view from window such that we reset
the windows first responder if any of the removed views in first
responder (avoid crash iv views subsequently deallocated).
Mon Dec 20 11:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Mon Dec 20 11:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSSavePanel.m: Use symbolic constants for resize mask. * Source/NSSavePanel.m: Use symbolic constants for resize mask.

View file

@ -387,10 +387,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{ {
return; return;
} }
if ([window firstResponder] == self)
{
[window makeFirstResponder: window];
}
RETAIN(self); RETAIN(self);
[super_view->sub_views removeObjectIdenticalTo: self]; [super_view->sub_views removeObjectIdenticalTo: self];
if ([super_view->sub_views count] == 0) if ([super_view->sub_views count] == 0)
@ -419,10 +415,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{ {
return; return;
} }
if ([window firstResponder] == self)
{
[window makeFirstResponder: window];
}
[super_view setNeedsDisplayInRect: frame]; [super_view setNeedsDisplayInRect: frame];
RETAIN(self); RETAIN(self);
[super_view->sub_views removeObjectIdenticalTo: self]; [super_view->sub_views removeObjectIdenticalTo: self];
@ -519,18 +511,27 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) viewWillMoveToWindow: (NSWindow*)newWindow - (void) viewWillMoveToWindow: (NSWindow*)newWindow
{ {
if (newWindow == window) if (newWindow == window)
{
return; return;
}
if (_rFlags.has_draginfo) if (_rFlags.has_draginfo)
{ {
NSGraphicsContext *ctxt = GSCurrentContext(); NSGraphicsContext *ctxt = GSCurrentContext();
NSArray *t = GSGetDragTypes(self); NSArray *t = GSGetDragTypes(self);
if (window != nil) if (window != nil)
{
[ctxt _removeDragTypes: t fromWindow: [window windowNumber]]; [ctxt _removeDragTypes: t fromWindow: [window windowNumber]];
}
if (newWindow != nil) if (newWindow != nil)
{
[ctxt _addDragTypes: t toWindow: [newWindow windowNumber]]; [ctxt _addDragTypes: t toWindow: [newWindow windowNumber]];
} }
}
if (newWindow == nil && [window firstResponder] == self)
{
[window makeFirstResponder: window];
}
window = newWindow; window = newWindow;
@ -545,10 +546,12 @@ GSSetDragTypes(NSView* obj, NSArray *types)
[sub_views getObjects: array]; [sub_views getObjects: array];
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)
{
[array[i] viewWillMoveToWindow: newWindow]; [array[i] viewWillMoveToWindow: newWindow];
} }
} }
} }
}
- (void) rotateByAngle: (float)angle - (void) rotateByAngle: (float)angle
{ {

View file

@ -1478,8 +1478,6 @@ resetCursorRectsForView(NSView *theView)
if ((first_responder) && (![first_responder resignFirstResponder])) if ((first_responder) && (![first_responder resignFirstResponder]))
return NO; return NO;
// FIXME
// [first_responder resignFirstResponder];
first_responder = aResponder; first_responder = aResponder;
[first_responder becomeFirstResponder]; [first_responder becomeFirstResponder];
return YES; return YES;
@ -2765,7 +2763,6 @@ resetCursorRectsForView(NSView *theView)
{ {
BOOL flag; BOOL flag;
NSPoint p; NSPoint p;
id nxt = RETAIN([self nextResponder]);
[super encodeWithCoder: aCoder]; [super encodeWithCoder: aCoder];
@ -2810,8 +2807,6 @@ resetCursorRectsForView(NSView *theView)
[aCoder encodeConditionalObject: _initial_first_responder]; [aCoder encodeConditionalObject: _initial_first_responder];
NSDebugLog(@"NSWindow: finish encoding\n"); NSDebugLog(@"NSWindow: finish encoding\n");
RELEASE(nxt);
} }
- (id) initWithCoder: (NSCoder*)aDecoder - (id) initWithCoder: (NSCoder*)aDecoder