Bug 1278437 - Null-check after allocating a tile's texture, before accessing it. r=jnicol, a=lizzard
authorNicolas Silva <nsilva@mozilla.com>
Wed, 15 Jun 2016 11:30:46 +0200
changeset 339728 6fae46fe5feededc16062836879dbd872933edf0
parent 339727 c61ac4fc1125899776b9dec46e824341ecbd238d
child 339729 7fb240e0de42aa35bb051a39a5d6f937438920db
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjnicol, lizzard
bugs1278437
milestone49.0a2
Bug 1278437 - Null-check after allocating a tile's texture, before accessing it. r=jnicol, a=lizzard
gfx/layers/client/TiledContentClient.cpp
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -666,35 +666,35 @@ TileClient::GetBackBuffer(const nsIntReg
     // re-use the front buffer.
     DiscardBackBuffer();
     Flip();
   } else {
     if (!mBackBuffer || mBackBuffer->IsReadLocked()) {
       mBackBuffer.Set(this,
         CreateBackBufferTexture(mBackBuffer, mCompositableClient, mAllocator)
       );
-      mInvalidBack = IntRect(0, 0, mBackBuffer->GetSize().width, mBackBuffer->GetSize().height);
       if (!mBackBuffer) {
         DiscardBackBuffer();
         DiscardFrontBuffer();
         return nullptr;
       }
+      mInvalidBack = IntRect(IntPoint(), mBackBuffer->GetSize());
     }
 
     if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA
         && (!mBackBufferOnWhite || mBackBufferOnWhite->IsReadLocked())) {
       mBackBufferOnWhite = CreateBackBufferTexture(
         mBackBufferOnWhite, mCompositableClient, mAllocator
       );
-      mInvalidBack = IntRect(0, 0, mBackBuffer->GetSize().width, mBackBuffer->GetSize().height);
       if (!mBackBufferOnWhite) {
         DiscardBackBuffer();
         DiscardFrontBuffer();
         return nullptr;
       }
+      mInvalidBack = IntRect(IntPoint(), mBackBufferOnWhite->GetSize());
     }
 
     ValidateBackBufferFromFront(aDirtyRegion, aAddPaintedRegion);
   }
 
   if (!mBackBuffer->IsLocked()) {
     if (!mBackBuffer->Lock(OpenMode::OPEN_READ_WRITE)) {
       gfxCriticalError() << "[Tiling:Client] Failed to lock a tile (B)";