mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 10:27:03 +00:00
Bug 316176 - unexpected early shutdown leads to crash when closing mail compose window, r=bienvenu
This commit is contained in:
parent
68554c4245
commit
cf740d7692
@ -77,6 +77,7 @@
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsIMimeMiscStatus.h"
|
||||
#include "nsXPFEComponentsCID.h"
|
||||
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
|
||||
@ -95,6 +96,7 @@
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
#include "nsICommandLine.h"
|
||||
#include "nsIAppStartup.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN32
|
||||
@ -234,7 +236,7 @@ void nsMsgComposeService::DeleteCachedWindows()
|
||||
PRInt32 i;
|
||||
for (i = 0; i < mMaxRecycledWindows; i ++)
|
||||
{
|
||||
CloseWindow(mCachedWindows[i].window);
|
||||
CloseHiddenCachedWindow(mCachedWindows[i].window);
|
||||
mCachedWindows[i].Clear();
|
||||
}
|
||||
}
|
||||
@ -305,7 +307,7 @@ nsresult nsMsgComposeService::OpenWindow(const char *chrome, nsIMsgComposeParams
|
||||
return rv;
|
||||
}
|
||||
|
||||
void nsMsgComposeService::CloseWindow(nsIDOMWindowInternal *domWindow)
|
||||
void nsMsgComposeService::CloseHiddenCachedWindow(nsIDOMWindowInternal *domWindow)
|
||||
{
|
||||
if (domWindow)
|
||||
{
|
||||
@ -324,8 +326,20 @@ void nsMsgComposeService::CloseWindow(nsIDOMWindowInternal *domWindow)
|
||||
{
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow;
|
||||
baseWindow = do_QueryInterface(treeOwner);
|
||||
if (baseWindow)
|
||||
if (baseWindow) {
|
||||
#ifdef MOZ_XUL_APP
|
||||
// HACK ALERT: when we hid this window we fired the "xul-window-destroyed"
|
||||
// notification for it. Now that it's being really-destroyed it will fire that
|
||||
// notification *again* for itself. The appstartup code maintains an internal
|
||||
// reference count of windows that block app shutdown: we want to increment that
|
||||
// count without cancelling app shutdown (so don't use "xul-window-registered").
|
||||
nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
|
||||
if (appStartup)
|
||||
appStartup->EnterLastWindowClosingSurvivalArea();
|
||||
#endif
|
||||
|
||||
baseWindow->Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -833,7 +847,7 @@ nsMsgComposeService::CacheWindow(nsIDOMWindowInternal *aWindow, PRBool aComposeH
|
||||
*/
|
||||
if (sameTypeId == -1 && oppositeTypeId != -1)
|
||||
{
|
||||
CloseWindow(mCachedWindows[oppositeTypeId].window);
|
||||
CloseHiddenCachedWindow(mCachedWindows[oppositeTypeId].window);
|
||||
mCachedWindows[oppositeTypeId].Clear();
|
||||
|
||||
rv = ShowCachedComposeWindow(aWindow, PR_FALSE);
|
||||
|
@ -107,7 +107,7 @@ private:
|
||||
nsMsgCachedWindowInfo *mCachedWindows;
|
||||
|
||||
nsresult OpenWindow( const char *chrome, nsIMsgComposeParams *params);
|
||||
void CloseWindow(nsIDOMWindowInternal *domWindow);
|
||||
void CloseHiddenCachedWindow(nsIDOMWindowInternal *domWindow);
|
||||
|
||||
nsresult ShowCachedComposeWindow(nsIDOMWindowInternal *aComposeWindow, PRBool aShow);
|
||||
|
||||
|
@ -365,7 +365,7 @@ nsAppStartup::ExitLastWindowClosingSurvivalArea(void)
|
||||
NS_ASSERTION(mConsiderQuitStopper > 0, "consider quit stopper out of bounds");
|
||||
--mConsiderQuitStopper;
|
||||
|
||||
if (mRunning && mConsiderQuitStopper == 0)
|
||||
if (!mShuttingDown && mRunning && mConsiderQuitStopper == 0)
|
||||
Quit(eAttemptQuit);
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user