Bug 971094 - Part 1: During shutdown, tell the profiler that the main thread JSRuntime is gone even if we leak. r=BenWa, r=bholley

This commit is contained in:
Emanuel Hoogeveen 2014-02-20 08:43:55 -05:00
parent 8f4969bd77
commit 9366d43366

View File

@ -832,6 +832,20 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
NS_WARNING("Component Manager was never created ...");
}
#ifdef MOZ_ENABLE_PROFILER_SPS
// In optimized builds we don't do shutdown collections by default, so
// uncollected (garbage) objects may keep the nsXPConnect singleton alive,
// and its XPCJSRuntime along with it. However, we still destroy various
// bits of state in JS_ShutDown(), so we need to make sure the profiler
// can't access them when it shuts down. This call nulls out the
// JS pseudo-stack's internal reference to the main thread JSRuntime,
// duplicating the call in XPCJSRuntime::~XPCJSRuntime() in case that
// never fired.
if (PseudoStack *stack = mozilla_get_pseudo_stack()) {
stack->sampleRuntime(nullptr);
}
#endif
// Shut down the JS engine.
JS_ShutDown();