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:
dbaron%fas.harvard.edu 2000-08-06 16:23:04 +00:00
Родитель 046920890e
Коммит 3faac42dec
3 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -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();