Bug 1273227 - Fix an assertion in TextureClient::Unlock(). r=nical

MozReview-Commit-ID: JwWPe4F0NCq

--HG--
extra : rebase_source : 82262bd0a1ca7a0aa32e7007578b5b00e8139f0f
This commit is contained in:
Botond Ballo 2016-05-25 13:16:25 -04:00
parent 5945a3f065
commit ee8e0b9c30

View File

@ -1043,13 +1043,17 @@ TextureClient::SetRemoveFromCompositableWaiter(AsyncTransactionWaiter* aWaiter)
already_AddRefed<gfx::DataSourceSurface>
TextureClient::GetAsSurface()
{
Lock(OpenMode::OPEN_READ);
if (!Lock(OpenMode::OPEN_READ)) {
return nullptr;
}
RefPtr<gfx::DataSourceSurface> data;
RefPtr<gfx::DrawTarget> dt = BorrowDrawTarget();
if (dt) {
RefPtr<gfx::SourceSurface> surf = dt->Snapshot();
if (surf) {
data = surf->GetDataSurface();
{ // scope so that the DrawTarget is destroyed before Unlock()
RefPtr<gfx::DrawTarget> dt = BorrowDrawTarget();
if (dt) {
RefPtr<gfx::SourceSurface> surf = dt->Snapshot();
if (surf) {
data = surf->GetDataSurface();
}
}
}
Unlock();