Bug 1300655 - part 2 - WorkerProxyToMainThreadRunnable::PostDispatchOnMainThread::ReleaseRunnable should implement Cancel() correctly, r=me
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 06 Sep 2016 04:48:11 +0200
changeset 312797 00bdb9edbe56af8e06c515e8c03f0026a5500933
parent 312796 cd2ae4eeae40b4d4dbc19cbe66b7d92cb68ff497
child 312798 0f431005c078af72bb30cfea04a362aca97b8868
push id30658
push usercbook@mozilla.com
push dateTue, 06 Sep 2016 13:28:59 +0000
treeherdermozilla-central@bec2b7e3c0eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1300655
milestone51.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 1300655 - part 2 - WorkerProxyToMainThreadRunnable::PostDispatchOnMainThread::ReleaseRunnable should implement Cancel() correctly, r=me
dom/workers/WorkerRunnable.cpp
--- a/dom/workers/WorkerRunnable.cpp
+++ b/dom/workers/WorkerRunnable.cpp
@@ -725,20 +725,24 @@ WorkerProxyToMainThreadRunnable::PostDis
     }
 
     virtual bool
     WorkerRun(JSContext* aCx, workers::WorkerPrivate* aWorkerPrivate) override
     {
       MOZ_ASSERT(aWorkerPrivate);
       aWorkerPrivate->AssertIsOnWorkerThread();
 
-      mRunnable->RunBackOnWorkerThread();
+      if (mRunnable) {
+        mRunnable->RunBackOnWorkerThread();
 
-      // Let's release the worker thread.
-      mRunnable->ReleaseWorker();
+        // Let's release the worker thread.
+        mRunnable->ReleaseWorker();
+        mRunnable = nullptr;
+      }
+
       return true;
     }
 
   private:
     ~ReleaseRunnable()
     {}
   };