From ee8e0b9c30b293353f4e0dcae6d6f9a287148639 Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Wed, 25 May 2016 13:16:25 -0400 Subject: [PATCH] Bug 1273227 - Fix an assertion in TextureClient::Unlock(). r=nical MozReview-Commit-ID: JwWPe4F0NCq --HG-- extra : rebase_source : 82262bd0a1ca7a0aa32e7007578b5b00e8139f0f --- gfx/layers/client/TextureClient.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 125ba09df9e8..b6b9584ab352 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -1043,13 +1043,17 @@ TextureClient::SetRemoveFromCompositableWaiter(AsyncTransactionWaiter* aWaiter) already_AddRefed TextureClient::GetAsSurface() { - Lock(OpenMode::OPEN_READ); + if (!Lock(OpenMode::OPEN_READ)) { + return nullptr; + } RefPtr data; - RefPtr dt = BorrowDrawTarget(); - if (dt) { - RefPtr surf = dt->Snapshot(); - if (surf) { - data = surf->GetDataSurface(); + { // scope so that the DrawTarget is destroyed before Unlock() + RefPtr dt = BorrowDrawTarget(); + if (dt) { + RefPtr surf = dt->Snapshot(); + if (surf) { + data = surf->GetDataSurface(); + } } } Unlock();