Bug 1485388 - Checking VRGPUChild is created before asking stop VRService. r=kip
authorDaosheng Mu <daoshengmu@gmail.com>
Mon, 27 Aug 2018 20:51:16 +0000
changeset 481950 683aadc6686ec5fcfb6dadc5c7a831323e06be85
parent 481949 8a38246f1a708ef0495415b1543d360f07d1ccd9
child 481951 e36b98a79cd85470eef43718b9c32c8bde54e3fd
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewerskip
bugs1485388
milestone63.0a1
Bug 1485388 - Checking VRGPUChild is created before asking stop VRService. r=kip MozReview-Commit-ID: 8NM2bcmqVAa Differential Revision: https://phabricator.services.mozilla.com/D4054
gfx/vr/VRManager.cpp
--- a/gfx/vr/VRManager.cpp
+++ b/gfx/vr/VRManager.cpp
@@ -172,17 +172,18 @@ VRManager::Shutdown()
   mVRControllers.Clear();
   for (uint32_t i = 0; i < mManagers.Length(); ++i) {
     mManagers[i]->Shutdown();
   }
 #if defined(XP_WIN) || defined(XP_MACOSX) || (defined(XP_LINUX) && !defined(MOZ_WIDGET_ANDROID))
   if (mVRService) {
     mVRService->Stop();
   }
-  if (gfxPrefs::VRProcessEnabled()) {
+  if (gfxPrefs::VRProcessEnabled() &&
+      VRGPUChild::IsCreated()) {
     RefPtr<Runnable> task = NS_NewRunnableFunction(
       "VRGPUChild::SendStopVRService",
       [] () -> void {
         VRGPUChild* vrGPUChild = VRGPUChild::Get();
         vrGPUChild->SendStopVRService();
     });
 
     NS_DispatchToMainThread(task.forget());