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

This commit is contained in:
dtownsend@oxymoronical.com 2007-12-11 02:35:02 -08:00
Родитель c5b065aa75
Коммит 3a6cfee7da
3 изменённых файлов: 22 добавлений и 13 удалений

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

@ -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

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

@ -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;
}

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

@ -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();
}
}
}