diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index 8b78a60a9fb..4ee415dfce3 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -398,7 +398,7 @@ private: static HSZ mApplication, mTopics[ topicCount ]; static DWORD mInstance; static char *mAppName; - static nsIDOMWindow *mInitialWindow; + static PRBool mInitialWindowActive; static PRBool mForceProfileStartup; static PRBool mSupportingDDEExec; static char mMutexName[]; @@ -743,7 +743,7 @@ int nsNativeAppSupportWin::mConversations = 0; HSZ nsNativeAppSupportWin::mApplication = 0; HSZ nsNativeAppSupportWin::mTopics[nsNativeAppSupportWin::topicCount] = { 0 }; DWORD nsNativeAppSupportWin::mInstance = 0; -nsIDOMWindow* nsNativeAppSupportWin::mInitialWindow = nsnull; +PRBool nsNativeAppSupportWin::mInitialWindowActive = PR_FALSE; PRBool nsNativeAppSupportWin::mForceProfileStartup = PR_FALSE; PRBool nsNativeAppSupportWin::mSupportingDDEExec = PR_FALSE; @@ -1721,7 +1721,7 @@ nsNativeAppSupportWin::HandleRequest( LPBYTE request, PRBool newWindow ) { // if initial hidden window is still being displayed, we need to ignore requests // because such requests might not function properly. See bug 147223 for details - if (mInitialWindow) { + if (mInitialWindowActive) { return; } @@ -2519,7 +2519,7 @@ nsNativeAppSupportWin::StartServerMode() { if ( !newWindow ) { return NS_OK; } - mInitialWindow = newWindow; + mInitialWindowActive = PR_TRUE; // Hide this window by re-parenting it (to ensure it doesn't appear). ReParent( newWindow, (HWND)MessageWindow() ); @@ -2547,11 +2547,8 @@ nsNativeAppSupportWin::OnLastWindowClosing( nsIXULWindow *aWindow ) { // If the last window closed is our special "turbo" window made // in StartServerMode(), don't do anything. - nsCOMPtr docShell; - ( void )aWindow->GetDocShell( getter_AddRefs( docShell ) ); - nsCOMPtr domWindow( do_GetInterface( docShell ) ); - if ( domWindow == mInitialWindow ) { - mInitialWindow = nsnull; + if ( mInitialWindowActive ) { + mInitialWindowActive = PR_FALSE; return NS_OK; } @@ -2595,15 +2592,21 @@ nsNativeAppSupportWin::OnLastWindowClosing( nsIXULWindow *aWindow ) { PRBool showDialog = PR_TRUE; if ( NS_SUCCEEDED( rv ) ) prefService->GetBoolPref( "browser.turbo.showDialog", &showDialog ); - nsCOMPtr domWindowInt ( do_GetInterface( docShell ) ); - if ( showDialog && domWindowInt ) { - nsCOMPtr newWindow; - mShownTurboDialog = PR_TRUE; - mLastWindowIsConfirmation = PR_TRUE; - domWindowInt->OpenDialog( NS_LITERAL_STRING( "chrome://navigator/content/turboDialog.xul" ), - NS_LITERAL_STRING( "_blank" ), - NS_LITERAL_STRING( "chrome,modal,titlebar,centerscreen,dialog" ), - nsnull, getter_AddRefs( newWindow ) ); + + if ( showDialog ) { + /* show turbo dialog, unparented. at this point in the application + shutdown process the last window is largely torn down and + unsuitable for parenthood. + */ + nsCOMPtr wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID)); + if ( wwatch ) { + nsCOMPtr newWindow; + mShownTurboDialog = PR_TRUE; + mLastWindowIsConfirmation = PR_TRUE; + rv = wwatch->OpenWindow(0, "chrome://navigator/content/turboDialog.xul", + "_blank", "chrome,modal,titlebar,centerscreen,dialog", + 0, getter_AddRefs(newWindow)); + } } }