Bug 1043929 - Unlock the mask texture in case of failure. r=Bas
authorNicolas Silva <nsilva@mozilla.com>
Mon, 28 Jul 2014 14:58:20 +0200
changeset 196274 4e3ea1113de325557745be4fa85b68b106d54218
parent 196273 23db9c4e3bfe33bfcb21cef51606b570f8e0a2d2
child 196275 0d8a1a23f5867f7993739881ab0e81422f726888
push id46841
push usernsilva@mozilla.com
push dateMon, 28 Jul 2014 12:58:56 +0000
treeherdermozilla-inbound@0d8a1a23f586 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1043929
milestone34.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 1043929 - Unlock the mask texture in case of failure. r=Bas
gfx/layers/composite/CompositableHost.cpp
--- a/gfx/layers/composite/CompositableHost.cpp
+++ b/gfx/layers/composite/CompositableHost.cpp
@@ -142,22 +142,33 @@ CompositableHost::SetCompositor(Composit
 
 bool
 CompositableHost::AddMaskEffect(EffectChain& aEffects,
                                 const gfx::Matrix4x4& aTransform,
                                 bool aIs3D)
 {
   RefPtr<TextureSource> source;
   RefPtr<TextureHost> host = GetAsTextureHost();
-  if (host && host->Lock()) {
-    source = host->GetTextureSources();
+
+  if (!host) {
+    NS_WARNING("Using compositable with no valid TextureHost as mask");
+    return false;
   }
 
+  if (!host->Lock()) {
+    NS_WARNING("Failed to lock the mask texture");
+    return false;
+  }
+
+  source = host->GetTextureSources();
+  MOZ_ASSERT(source);
+
   if (!source) {
-    NS_WARNING("Using compositable with no texture host as mask layer");
+    NS_WARNING("The TextureHost was successfully locked but can't provide a TextureSource");
+    host->Unlock();
     return false;
   }
 
   RefPtr<EffectMask> effect = new EffectMask(source,
                                              source->GetSize(),
                                              aTransform);
   effect->mIs3D = aIs3D;
   aEffects.mSecondaryEffects[EffectTypes::MASK] = effect;