From 08325d40f9a99223c1d08f86ace13a7de5cf95b5 Mon Sep 17 00:00:00 2001 From: rfm Date: Wed, 20 Sep 2006 11:00:25 +0000 Subject: [PATCH] Fix crash if content view is removed from window by moving it to another one. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23567 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/GSWindowDecorationView.m | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 270499183..bc9f1eb02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-20 Richard Frith-Macdonald + + * Source/GSWindowDecorationView.m: ([removeSubview:]) override to + check for removal of the window's content view and handle that + case so that the window knows the content view has gone. + 2006-09-17 Matt Rice * Source/NSDocument.m (-initWithContentsOfFile:ofType:): Set the diff --git a/Source/GSWindowDecorationView.m b/Source/GSWindowDecorationView.m index 938f787ce..391ed4de1 100644 --- a/Source/GSWindowDecorationView.m +++ b/Source/GSWindowDecorationView.m @@ -123,6 +123,20 @@ struct NSWindow_struct return self; } +- (void) removeSubview: (NSView*)aView +{ + RETAIN(aView); + /* + * If the content view is removed, we must let the window know. + */ + [super removeSubview: aView]; + if (aView == [_window contentView]) + { + [_window setContentView: nil]; + } + RELEASE(aView); +} + - (void) setBackgroundColor: (NSColor *)color { [self setNeedsDisplayInRect: contentRect];