зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
046920890e
Коммит
3faac42dec
|
@ -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();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче