Bug 1120331 - "crash in mozilla::ipc::MessageChannel::Send(IPC::Message*)". r=sotaro
authorNicolas Silva <nsilva@mozilla.com>
Wed, 04 Feb 2015 07:15:00 +0100
changeset 256058 7d4f76e0411bf46f7f6cfd236bd2578c6e214055
parent 256057 8a411bde0705b16f168766843c833b1e3447fd95
child 256059 0d0e9ab07f41172dffe1d689ae73d787b39cd479
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1120331
milestone38.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 1120331 - "crash in mozilla::ipc::MessageChannel::Send(IPC::Message*)". r=sotaro
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/client/ClientLayerManager.h
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -707,16 +707,20 @@ ClientLayerManager::ReturnTextureClient(
 void
 ClientLayerManager::ReportClientLost(TextureClient& aClient) {
   GetTexturePool(aClient.GetFormat())->ReportClientLost();
 }
 
 void
 ClientLayerManager::ClearCachedResources(Layer* aSubtree)
 {
+  if (mDestroyed) {
+    // ClearCachedResource was already called by ClientLayerManager::Destroy
+    return;
+  }
   MOZ_ASSERT(!HasShadowManager() || !aSubtree);
   mForwarder->ClearCachedResources();
   if (aSubtree) {
     ClearLayer(aSubtree);
   } else if (mRoot) {
     ClearLayer(mRoot);
   }
   for (size_t i = 0; i < mTexturePools.Length(); i++) {
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -40,18 +40,20 @@ class ClientLayerManager MOZ_FINAL : pub
 {
   typedef nsTArray<nsRefPtr<Layer> > LayerRefArray;
 
 public:
   explicit ClientLayerManager(nsIWidget* aWidget);
 
   virtual void Destroy() MOZ_OVERRIDE
   {
+    // It's important to call ClearCachedResource before Destroy because the
+    // former will early-return if the later has already run.
+    ClearCachedResources();
     LayerManager::Destroy();
-    ClearCachedResources();
   }
 
 protected:
   virtual ~ClientLayerManager();
 
 public:
   virtual ShadowLayerForwarder* AsShadowForwarder() MOZ_OVERRIDE
   {