Bug 396234: Crash when dialog comes up before automatic shutdown on Mac.

r=bsmedberg.


git-svn-id: svn://10.0.0.236/trunk@240825 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dtownsend%oxymoronical.com
2007-12-11 10:35:02 +00:00
parent 9d0dec7a17
commit f00e87a9c9
3 changed files with 22 additions and 13 deletions

View File

@@ -41,7 +41,7 @@
interface nsICmdLineService;
[scriptable, uuid(e9b0f89b-0529-4d96-98a8-eb5b2b9a8383)]
[scriptable, uuid(6799abed-4721-4f51-9304-d1a2ea1df5d5)]
interface nsIAppStartup : nsISupports
{
/**
@@ -49,6 +49,12 @@ interface nsIAppStartup : nsISupports
*/
void createHiddenWindow();
/**
* Destroys the hidden window. This will have no effect if the hidden window
* has not yet been created.
*/
void destroyHiddenWindow();
/**
* Runs an application event loop: normally the main event pump which
* defines the lifetime of the application. If there are no windows open

View File

@@ -150,6 +150,17 @@ nsAppStartup::CreateHiddenWindow()
}
NS_IMETHODIMP
nsAppStartup::DestroyHiddenWindow()
{
nsCOMPtr<nsIAppShellService> appShellService
(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
NS_ENSURE_TRUE(appShellService, NS_ERROR_FAILURE);
return appShellService->DestroyHiddenWindow();
}
NS_IMETHODIMP
nsAppStartup::Run(void)
{
@@ -300,12 +311,6 @@ nsAppStartup::Quit(PRUint32 aMode)
mRestart ? restartStr.get() : shutdownStr.get());
}
nsCOMPtr<nsIAppShellService> appShellService
(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
NS_ASSERTION(appShellService, "We're gonna leak something.");
if (appShellService)
appShellService->DestroyHiddenWindow();
if (!mRunning) {
postedExitEvent = PR_TRUE;
}

View File

@@ -850,6 +850,10 @@ private:
ScopedXPCOMStartup::~ScopedXPCOMStartup()
{
if (mServiceManager) {
nsCOMPtr<nsIAppStartup> appStartup (do_GetService(NS_APPSTARTUP_CONTRACTID));
if (appStartup)
appStartup->DestroyHiddenWindow();
gDirServiceProvider->DoShutdown();
WriteConsoleLog();
@@ -3182,12 +3186,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
#ifdef XP_MACOSX
SetupMacCommandLine(gRestartArgc, gRestartArgv);
#endif
// Ensure hidden window is destroyed before xpcom shuts down
nsCOMPtr<nsIAppShellService> appShellService
(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
if (appShellService)
appShellService->DestroyHiddenWindow();
}
}
}