mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fixing bug 516113. Don't let new windows open up after we've started XPCOM shutdown. r=bsmedberg, a=blocking1.9.2+
This commit is contained in:
parent
8f2f143350
commit
10141fcf45
@ -520,6 +520,13 @@ NS_CycleCollectorForget2(nsPurpleBufferEntry *e);
|
||||
*/
|
||||
#define NS_XPCOM_STARTUP_OBSERVER_ID "xpcom-startup"
|
||||
|
||||
/**
|
||||
* At XPCOM shutdown, this topic is notified just before "xpcom-shutdown".
|
||||
* Components should only use this to mark themselves as 'being destroyed'.
|
||||
* Nothing should be dispatched to any event loop.
|
||||
*/
|
||||
#define NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID "xpcom-will-shutdown"
|
||||
|
||||
/**
|
||||
* At XPCOM shutdown, this topic is notified. All components must
|
||||
* release any interface references to objects in other modules when
|
||||
|
@ -679,6 +679,10 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
|
||||
|
||||
if (observerService)
|
||||
{
|
||||
(void) observerService->
|
||||
NotifyObservers(nsnull, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID,
|
||||
nsnull);
|
||||
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -82,6 +82,7 @@
|
||||
class nsIAppShell;
|
||||
|
||||
nsAppShellService::nsAppShellService() :
|
||||
mXPCOMWillShutDown(PR_FALSE),
|
||||
mXPCOMShuttingDown(PR_FALSE),
|
||||
mModalWindowCount(0),
|
||||
mApplicationProvidedHiddenWindow(PR_FALSE)
|
||||
@ -89,8 +90,10 @@ nsAppShellService::nsAppShellService() :
|
||||
nsCOMPtr<nsIObserverService> obs
|
||||
(do_GetService("@mozilla.org/observer-service;1"));
|
||||
|
||||
if (obs)
|
||||
if (obs) {
|
||||
obs->AddObserver(this, "xpcom-will-shutdown", PR_FALSE);
|
||||
obs->AddObserver(this, "xpcom-shutdown", PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
nsAppShellService::~nsAppShellService()
|
||||
@ -297,6 +300,7 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
||||
nsWebShellWindow **aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
NS_ENSURE_STATE(!mXPCOMWillShutDown);
|
||||
|
||||
nsCOMPtr<nsIXULWindow> parent;
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_DEPENDENT)
|
||||
@ -562,12 +566,16 @@ NS_IMETHODIMP
|
||||
nsAppShellService::Observe(nsISupports* aSubject, const char *aTopic,
|
||||
const PRUnichar *aData)
|
||||
{
|
||||
NS_ASSERTION(!strcmp(aTopic, "xpcom-shutdown"), "Unexpected observer topic!");
|
||||
|
||||
mXPCOMShuttingDown = PR_TRUE;
|
||||
if (mHiddenWindow) {
|
||||
ClearXPConnectSafeContext();
|
||||
mHiddenWindow->Destroy();
|
||||
if (!strcmp(aTopic, "xpcom-will-shutdown")) {
|
||||
mXPCOMWillShutDown = PR_TRUE;
|
||||
} else if (!strcmp(aTopic, "xpcom-shutdown")) {
|
||||
mXPCOMShuttingDown = PR_TRUE;
|
||||
if (mHiddenWindow) {
|
||||
ClearXPConnectSafeContext();
|
||||
mHiddenWindow->Destroy();
|
||||
}
|
||||
} else {
|
||||
NS_ERROR("Unexpected observer topic!");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -74,6 +74,7 @@ protected:
|
||||
nsresult ClearXPConnectSafeContext();
|
||||
|
||||
nsRefPtr<nsWebShellWindow> mHiddenWindow;
|
||||
PRPackedBool mXPCOMWillShutDown;
|
||||
PRPackedBool mXPCOMShuttingDown;
|
||||
PRUint16 mModalWindowCount;
|
||||
PRPackedBool mApplicationProvidedHiddenWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user