mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1716084 - Use StaticAutoPtr instead for ProfilerParentTracker global instance r=aabh,profiler-reviewers
Previously we were using a static UniquePtr to hold the static ProfilerParentTracker instance. This was causing us to always try to call the destructor on the exit handlers. But this should only happen during a normal shutdown, we register that cleanup here: https://searchfox.org/mozilla-central/rev/b477cd37e845005dac8881427fa06a2771d993db/tools/profiler/gecko/ProfilerParent.cpp#520. StaticAutoPtr doesn't have a static destructors, which avoids the risk of some static destructors running due to a failure early during startup. Differential Revision: https://phabricator.services.mozilla.com/D229362
This commit is contained in:
parent
13c85936fc
commit
3dab5360a0
@ -506,13 +506,13 @@ ProfilerParentTracker* ProfilerParentTracker::GetInstance() {
|
||||
|
||||
// The main instance pointer, it will be initialized at most once, before
|
||||
// XPCOMShutdownThreads.
|
||||
static UniquePtr<ProfilerParentTracker> instance = nullptr;
|
||||
static StaticAutoPtr<ProfilerParentTracker> instance;
|
||||
if (MOZ_UNLIKELY(!instance)) {
|
||||
if (PastShutdownPhase(ShutdownPhase::XPCOMShutdownThreads)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
instance = MakeUnique<ProfilerParentTracker>();
|
||||
instance = new ProfilerParentTracker();
|
||||
|
||||
// The tracker should get destroyed before threads are shutdown, because its
|
||||
// destruction closes extant channels, which could trigger promise
|
||||
|
Loading…
Reference in New Issue
Block a user