Bug 1328633 - Only call LayerTransactionChild::Destroy on the main thread. bug 1328633, r=mattwoodrow a=gchang
authorDavid Anderson <danderson@mozilla.com>
Wed, 08 Feb 2017 07:21:45 -0800
changeset 376074 9ee3f47f2a10f8d665580296c7cb41c9d7e80848
parent 376073 2318c2c87a23c5fff7c93c7594b8041c3d511f62
child 376075 44133d6f9edc3a1f85d5327b17aee98dfaecbdec
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, gchang
bugs1328633
milestone53.0a2
Bug 1328633 - Only call LayerTransactionChild::Destroy on the main thread. bug 1328633, r=mattwoodrow a=gchang
gfx/layers/ipc/ShadowLayers.cpp
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -208,18 +208,24 @@ struct ReleaseOnMainThreadTask : public 
 };
 
 ShadowLayerForwarder::~ShadowLayerForwarder()
 {
   MOZ_ASSERT(mTxn->Finished(), "unfinished transaction?");
   delete mTxn;
   if (mShadowManager) {
     mShadowManager->SetForwarder(nullptr);
-    mShadowManager->Destroy();
+    if (NS_IsMainThread()) {
+      mShadowManager->Destroy();
+    } else {
+      NS_DispatchToMainThread(
+        NewRunnableMethod(mShadowManager, &LayerTransactionChild::Destroy));
+    }
   }
+
   if (!NS_IsMainThread()) {
     NS_DispatchToMainThread(
       new ReleaseOnMainThreadTask<ActiveResourceTracker>(mActiveResourceTracker));
   }
 }
 
 void
 ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds,