Bug 1343666 - Prevent crash on shutdown due to assertion in VRManagerChild::Get()
- Updated VREventObserver::DisconnectFromOwner() to call VRManagerChild::IsCreated()
before calling the accessor VRManageRchild::Get() containing the assertion.
MozReview-Commit-ID: Ezy08m6V4HV
--- 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()) {