Bug 1530663 - Avoid running remaining VRManager tasks after mTaskTimer has been stopped r=daoshengmu
authorKearwood "Kip" Gilbert <kgilbert@mozilla.com>
Tue, 05 Mar 2019 22:32:58 +0000
changeset 520383 641501728149842df11bc6353b629bad83b8f204
parent 520382 095dde8fb209840abc24088020b67f144784d292
child 520384 975cde7ee79a3dc935a0f13497cb1ff80d5537f5
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu
bugs1530663
milestone67.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 1530663 - Avoid running remaining VRManager tasks after mTaskTimer has been stopped r=daoshengmu Differential Revision: https://phabricator.services.mozilla.com/D22188
gfx/vr/VRManager.cpp
--- a/gfx/vr/VRManager.cpp
+++ b/gfx/vr/VRManager.cpp
@@ -241,16 +241,23 @@ void VRManager::TaskTimerCallback(nsITim
   self->RunTasks();
 }
 
 void VRManager::RunTasks() {
   // Will be called once every 1ms when a VR presentation
   // is active or once per vsync when a VR presentation is
   // not active.
 
+  if (!mInitialized) {
+    // We may have been destroyed but still have messages
+    // in the queue from mTaskTimer.  Bail out to avoid
+    // running them.
+    return;
+  }
+
   TimeStamp now = TimeStamp::Now();
   double lastTickMs = mAccumulator100ms;
   double deltaTime = 0.0f;
   if (!mLastTickTime.IsNull()) {
     deltaTime = (now - mLastTickTime).ToMilliseconds();
   }
   mAccumulator100ms += deltaTime;
   mLastTickTime = now;