Bug 959615 - Early return instead of crash if invalid state in ReceiveCompositableUpdate. r=bjacob, a=bajaj
authorNicolas Silva <nical.bugzilla@gmail.com>
Tue, 28 Jan 2014 17:00:38 -0500
changeset 175077 07f77213ecf1ff028407968c39b136004b11dedf
parent 175076 71311d19a111f22f40a7ae0efac75cfc55cfde23
child 175078 0596865af40ecd3455894949728b9a3d6368f110
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob, bajaj
bugs959615
milestone28.0a2
Bug 959615 - Early return instead of crash if invalid state in ReceiveCompositableUpdate. r=bjacob, a=bajaj
gfx/layers/ipc/CompositableTransactionParent.cpp
--- a/gfx/layers/ipc/CompositableTransactionParent.cpp
+++ b/gfx/layers/ipc/CompositableTransactionParent.cpp
@@ -267,16 +267,20 @@ CompositableParentManager::ReceiveCompos
       if (op.textureID() == 0) {
         NS_WARNING("Invalid texture ID");
         break;
       }
       CompositableHost* compositable = AsCompositable(op);
 
       RefPtr<TextureHost> texture = compositable->GetTextureHost(op.textureID());
       MOZ_ASSERT(texture);
+      if (!texture) {
+        NS_WARNING("Could not find texture");
+        break;
+      }
 
       TextureFlags flags = texture->GetFlags();
 
       if (!(flags & TEXTURE_DEALLOCATE_CLIENT) &&
           !(flags & TEXTURE_DEALLOCATE_DEFERRED)) {
         texture->DeallocateSharedData();
       }
 
@@ -297,16 +301,20 @@ CompositableParentManager::ReceiveCompos
       if (op.textureID() == 0) {
         NS_WARNING("Invalid texture ID");
         break;
       }
       CompositableHost* compositable = AsCompositable(op);
       MOZ_ASSERT(compositable);
       RefPtr<TextureHost> texture = compositable->GetTextureHost(op.textureID());
       MOZ_ASSERT(texture);
+      if (!texture) {
+        NS_WARNING("Could not find texture");
+        break;
+      }
 
       texture->Updated(op.region().type() == MaybeRegion::TnsIntRegion
                        ? &op.region().get_nsIntRegion()
                        : nullptr); // no region means invalidate the entire surface
 
 
       compositable->UseTextureHost(texture);
       ReturnReleaseFenceIfNecessary(compositable, replyv, op.compositableParent());