Bug 1061699 - Only crash debug builds if BorrowDrawTarget is called on an unlocked TextureClient. r=Bas

This commit is contained in:
Nicolas Silva 2014-09-16 14:32:24 +02:00
parent 426b1eaffa
commit 2d36152b7a
4 changed files with 10 additions and 2 deletions

View File

@ -688,6 +688,9 @@ BufferTextureClient::BorrowDrawTarget()
{
MOZ_ASSERT(IsValid());
MOZ_ASSERT(mLocked, "BorrowDrawTarget should be called on locked textures only");
if (!mLocked) {
return nullptr;
}
if (mDrawTarget) {
mDrawTarget->SetTransform(Matrix());

View File

@ -310,7 +310,7 @@ TextureClientD3D11::BorrowDrawTarget()
{
MOZ_ASSERT(mIsLocked, "Calling TextureClient::BorrowDrawTarget without locking :(");
if (!mTexture && !mTexture10) {
if (!mIsLocked || (!mTexture && !mTexture10)) {
return nullptr;
}

View File

@ -664,6 +664,11 @@ gfx::DrawTarget*
CairoTextureClientD3D9::BorrowDrawTarget()
{
MOZ_ASSERT(mIsLocked && mD3D9Surface);
if (!mIsLocked || !mD3D9Surface) {
NS_WARNING("Calling BorrowDrawTarget on an Unlocked TextureClient");
return nullptr;
}
if (mDrawTarget) {
return mDrawTarget;
}

View File

@ -194,7 +194,7 @@ GrallocTextureClientOGL::BorrowDrawTarget()
MOZ_ASSERT(IsValid());
MOZ_ASSERT(mMappedBuffer, "Calling TextureClient::BorrowDrawTarget without locking :(");
if (!IsValid() || !IsAllocated()) {
if (!IsValid() || !IsAllocated() || !mMappedBuffer) {
return nullptr;
}