mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Fix crash on shutdown (or patch things up so they don't crash) by releasing memory pressure observers closer to the beginning of XPCOM shutdown. b=47791 r=waterson@netscape.com
This commit is contained in:
parent
ec2dd3adc2
commit
710b05e789
@ -195,12 +195,16 @@ nsMemoryImpl::Startup()
|
||||
return Create(nsnull, NS_GET_IID(nsIMemory), (void**)&gMemory);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMemoryImpl::ReleaseObservers()
|
||||
{
|
||||
// set mObservers to null to release observers
|
||||
((nsMemoryImpl*)gMemory)->mObservers = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMemoryImpl::Shutdown()
|
||||
{
|
||||
// set mObservers to null just to be conservative:
|
||||
((nsMemoryImpl*)gMemory)->mObservers = nsnull;
|
||||
|
||||
NS_RELEASE(gMemory);
|
||||
gMemory = nsnull;
|
||||
return NS_OK;
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
|
||||
// called from xpcom initialization/finalization:
|
||||
static nsresult Startup();
|
||||
static nsresult ReleaseObservers();
|
||||
static nsresult Shutdown();
|
||||
|
||||
static NS_METHOD
|
||||
|
@ -611,6 +611,10 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr)
|
||||
// will cause servicemanager to become inaccessible.
|
||||
gShuttingDown = PR_TRUE;
|
||||
|
||||
// Release memory pressure observers now so that things get
|
||||
// released earlier.
|
||||
nsMemoryImpl::ReleaseObservers();
|
||||
|
||||
// Release our own singletons...
|
||||
XPTI_FreeInterfaceInfoManager();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user