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.

This commit is contained in:
bryner%netscape.com 2002-01-16 03:36:50 +00:00
Родитель d974e9c1e6
Коммит 350238438c
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -575,6 +575,11 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent)
nsCOMPtr<nsIDOMWindowInternal> 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<nsIWebShellWindow> 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.