Bug 1343666 - Prevent crash on shutdown due to assertion in VRManagerChild::Get() r=daoshengmu
authorKearwood Gilbert <kgilbert@mozilla.com>
Thu, 02 Mar 2017 13:07:24 -0800
changeset 345715 06074f7e890125261d08c88a7769e24acba7ab76
parent 345714 6e4c4e2e714794f73b06633ac42cf2a90da1d4c8
child 345716 eb6b0553d0797d7b8a88006080add8992d5dfa97
push id31443
push usercbook@mozilla.com
push dateFri, 03 Mar 2017 12:01:25 +0000
treeherdermozilla-central@31c09bb63b69 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu
bugs1343666
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1343666 - Prevent crash on shutdown due to assertion in VRManagerChild::Get() r=daoshengmu - Updated VREventObserver::DisconnectFromOwner() to call VRManagerChild::IsCreated() before calling the accessor VRManageRchild::Get() containing the assertion. MozReview-Commit-ID: Ezy08m6V4HV
dom/vr/VREventObserver.cpp
--- a/dom/vr/VREventObserver.cpp
+++ b/dom/vr/VREventObserver.cpp
@@ -40,18 +40,18 @@ void
 VREventObserver::DisconnectFromOwner()
 {
   // In the event that nsGlobalWindow is deallocated, VREventObserver may
   // still be AddRef'ed elsewhere.  Ensure that we don't UAF by
   // dereferencing mWindow.
   mWindow = nullptr;
 
   // Unregister from VRManagerChild
-  VRManagerChild* vmc = VRManagerChild::Get();
-  if (vmc) {
+  if (VRManagerChild::IsCreated()) {
+    VRManagerChild* vmc = VRManagerChild::Get();
     vmc->RemoveListener(this);
   }
 }
 
 void
 VREventObserver::NotifyVRDisplayMounted(uint32_t aDisplayID)
 {
   if (mWindow && mWindow->AsInner()->IsCurrentInnerWindow()) {