Fix focus crasher resulting from the window's firstResponder pointing to a deleted NSView. Bug 159291, r/sr=hyatt. Not part of the build.

This commit is contained in:
bryner%netscape.com 2002-07-25 21:31:51 +00:00
Родитель 8285e099f1
Коммит 9b5d4b8eab
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -162,6 +162,16 @@ nsChildView::nsChildView() : nsBaseWidget() , nsDeleteObserved(this)
nsChildView::~nsChildView()
{
if ( mView ) {
NSWindow* win = [mView window];
NSResponder* responder = [win firstResponder];
// We're being unhooked from the view hierarchy, don't leave our view
// or a child view as the window first responder.
if (responder && [responder isKindOfClass:[NSView class]] &&
[(NSView*)responder isDescendantOf:mView])
[win makeFirstResponder: [mView superview]];
[mView removeFromSuperviewWithoutNeedingDisplay];
[mView release];
}