2239 Crash when leaving test9

This commit is contained in:
davidm%netscape.com 1999-01-22 01:49:08 +00:00
parent a2439bb775
commit 559c7cca3c
2 changed files with 9 additions and 2 deletions

@ -74,6 +74,7 @@ void nsToolkit::SetFocus(nsWindow *aFocusWidget)
guiEvent.message = NS_LOSTFOCUS;
guiEvent.widget = mFocusedWidget;
mFocusedWidget->DispatchWindowEvent(guiEvent);
mFocusedWidget = nil;
}
// let the new one know

@ -75,7 +75,7 @@ nsWindow::~nsWindow()
::DisposeRgn(mWindowRegion);
mWindowRegion = nsnull;
}
NS_IF_RELEASE(mTempRenderingContext);
}
@ -170,7 +170,13 @@ NS_IMETHODIMP nsWindow::Destroy()
if (mDestroyCalled)
return NS_OK;
mDestroyCalled = PR_TRUE;
// if the window being destroyed has the focus, lose it so that there isn't a dangling reference
if (mToolkit && ((nsToolkit*)mToolkit)->GetFocus() == this )
{
((nsToolkit*)mToolkit)->SetFocus( nil );
}
nsBaseWidget::OnDestroy();
nsBaseWidget::Destroy();