From 9037da04aff24aa8eb33e1f200701206c8c3e3b3 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Thu, 24 Jan 2002 23:39:00 +0000 Subject: [PATCH] in Destroy(), call appshellservice->Unregister a little earlier. bug 119549 r=ben,hyatt,law git-svn-id: svn://10.0.0.236/trunk@112767 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpfe/appshell/src/nsXULWindow.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.cpp b/mozilla/xpfe/appshell/src/nsXULWindow.cpp index 99c20974cd5..c8e817d8411 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsXULWindow.cpp @@ -317,10 +317,19 @@ NS_IMETHODIMP nsXULWindow::Create() NS_IMETHODIMP nsXULWindow::Destroy() { - mBeingDestroyed = PR_TRUE; if(!mWindow) return NS_OK; + { + /* unregister before setting mBeingDestroyed because -turbo code + wants to be able to pose a dialog. */ + nsCOMPtr appShell(do_GetService(kAppShellServiceCID)); + if(appShell) + appShell->UnregisterTopLevelWindow(NS_STATIC_CAST(nsIXULWindow*, this)); + } + + mBeingDestroyed = PR_TRUE; + nsCOMPtr parentWindow(do_QueryReferent(mParentWindow)); if (parentWindow) parentWindow->RemoveChildWindow(this); @@ -348,10 +357,6 @@ NS_IMETHODIMP nsXULWindow::Destroy() } #endif - nsCOMPtr appShell(do_GetService(kAppShellServiceCID)); - if(appShell) - appShell->UnregisterTopLevelWindow(NS_STATIC_CAST(nsIXULWindow*, this)); - // let's make sure the window doesn't get deleted out from under us // while we are trying to close....this can happen if the docshell // we close ends up being the last owning reference to this xulwindow