Bug 1213429 - Check the result of LockRect. r=Bas
authorBenoit Girard <b56girard@gmail.com>
Fri, 05 Feb 2016 13:02:01 -0500
changeset 283250 0c45f40620754ceb3ae0319f7b9b6255660146ac
parent 283249 bbb2e9a908163f6d7883cd174a85fe24a33f1da9
child 283327 3c3e39e9becc24e6bc8b305078e86bfdc9c7f200
push id71490
push userb56girard@gmail.com
push dateSat, 06 Feb 2016 03:32:49 +0000
treeherdermozilla-inbound@0c45f4062075 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1213429
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1213429 - Check the result of LockRect. r=Bas
gfx/layers/d3d9/TextureD3D9.cpp
--- a/gfx/layers/d3d9/TextureD3D9.cpp
+++ b/gfx/layers/d3d9/TextureD3D9.cpp
@@ -426,17 +426,21 @@ DataTextureSourceD3D9::Update(gfx::DataS
         return false;
       }
     }
 
     RefPtr<IDirect3DSurface9> destSurface;
     mTexture->GetSurfaceLevel(0, getter_AddRefs(destSurface));
 
     D3DLOCKED_RECT rect;
-    srcSurface->LockRect(&rect, nullptr, 0);
+    HRESULT hr = srcSurface->LockRect(&rect, nullptr, 0);
+    if (FAILED(hr) || !rect.pBits) {
+      gfxCriticalError() << "Failed to lock rect initialize texture in D3D9 " << hexa(hr);
+      return nullptr;
+    }
 
     for (auto iter = regionToUpdate.RectIter(); !iter.Done(); iter.Next()) {
       const nsIntRect& iterRect = iter.Get();
       uint8_t* src = map.mData + map.mStride * iterRect.y + BytesPerPixel(aSurface->GetFormat()) * iterRect.x;
       uint8_t* dest = reinterpret_cast<uint8_t*>(rect.pBits) + rect.Pitch * iterRect.y + BytesPerPixel(aSurface->GetFormat()) * iterRect.x;
 
       for (int y = 0; y < iterRect.height; y++) {
         memcpy(dest + rect.Pitch * y,