From 7841da0a8110712b2cef893bdb8ef93950352a57 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Wed, 11 Dec 2013 18:32:41 +0100 Subject: [PATCH] Bug 948955 - AddMaskEffect handles locking failure. r=bjacob --- gfx/layers/composite/CompositableHost.cpp | 6 ++---- gfx/layers/composite/LayerManagerComposite.cpp | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gfx/layers/composite/CompositableHost.cpp b/gfx/layers/composite/CompositableHost.cpp index 04edab1be3e2..6e3a71501ddc 100644 --- a/gfx/layers/composite/CompositableHost.cpp +++ b/gfx/layers/composite/CompositableHost.cpp @@ -136,13 +136,11 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects, { RefPtr source; RefPtr oldHost = GetDeprecatedTextureHost(); - if (oldHost) { - oldHost->Lock(); + if (oldHost && oldHost->Lock()) { source = oldHost; } else { RefPtr host = GetAsTextureHost(); - if (host) { - host->Lock(); + if (host && host->Lock()) { source = host->GetTextureSources(); } } diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index e16fbb2d6a21..7ac217f24c61 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -726,7 +726,9 @@ LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer, gfx::Matrix4x4 transform; ToMatrix4x4(aMaskLayer->GetEffectiveTransform(), transform); - mCompositable->AddMaskEffect(aEffects, transform, aIs3D); + if (!mCompositable->AddMaskEffect(aEffects, transform, aIs3D)) { + mCompositable = nullptr; + } } LayerManagerComposite::AutoAddMaskEffect::~AutoAddMaskEffect()