From 5491e0a08e7ca952df8ac60f84623253b32877c4 Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Wed, 16 Jan 2002 03:36:50 +0000 Subject: [PATCH] Fix for focus crash bugs 107844, 104297, and 109645. Make sure the window doesn't get deleted out from under us. r=saari, sr=blizzard. --- xpfe/appshell/src/nsWebShellWindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 28a686713262..60db3e6cb982 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -575,6 +575,11 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) nsCOMPtr focusedWindow; focusController->GetFocusedWindow(getter_AddRefs(focusedWindow)); if (focusedWindow) { + // It's possible for focusing the window to cause it to close. + // To avoid holding a pointer to deleted memory, keep a reference + // on eventWindow. -bryner + nsCOMPtr kungFuDeathGrip(eventWindow); + focusController->SetSuppressFocus(PR_TRUE, "Activation Suppression"); domWindow->Focus(); // This sets focus, but we'll ignore it. // A subsequent activate will cause us to stop suppressing.