Bug 811394. Prevent recursion into nsXULWindow::Destroy. r=smaug

This commit is contained in:
Boris Zbarsky 2012-11-15 08:28:40 -08:00
parent eaf74f362b
commit fecdb58ed6
2 changed files with 11 additions and 0 deletions

View File

@ -95,6 +95,7 @@ nsXULWindow::nsXULWindow(uint32_t aChromeFlags)
mIgnoreXULPosition(false),
mChromeFlagsFrozen(false),
mIgnoreXULSizeMode(false),
mDestroying(false),
mContextFlags(0),
mPersistentAttributesDirty(0),
mPersistentAttributesMask(0),
@ -409,6 +410,13 @@ NS_IMETHODIMP nsXULWindow::Destroy()
if (!mWindow)
return NS_OK;
// Ensure we don't reenter this code
if (mDestroying)
return NS_OK;
mozilla::AutoRestore<bool> guard(mDestroying);
mDestroying = true;
nsCOMPtr<nsIAppShellService> appShell(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
NS_ASSERTION(appShell, "Couldn't get appShell... xpcom shutdown?");
if (appShell)

View File

@ -138,6 +138,9 @@ protected:
bool mIgnoreXULPosition;
bool mChromeFlagsFrozen;
bool mIgnoreXULSizeMode;
// mDestroying is used to prevent reentry into into Destroy(), which can
// otherwise happen due to script running as we tear down various things.
bool mDestroying;
uint32_t mContextFlags;
uint32_t mPersistentAttributesDirty; // persistentAttributes
uint32_t mPersistentAttributesMask;