зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
0d7e39c675
Коммит
4b3d91ac47
|
@ -162,6 +162,16 @@ nsChildView::nsChildView() : nsBaseWidget() , nsDeleteObserved(this)
|
||||||
nsChildView::~nsChildView()
|
nsChildView::~nsChildView()
|
||||||
{
|
{
|
||||||
if ( mView ) {
|
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 removeFromSuperviewWithoutNeedingDisplay];
|
||||||
[mView release];
|
[mView release];
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче