Bug 1521368 - Part 2: Ensure destination DT is valid when replaying SourceSurfaceCapture. r=rhunt a=lizzard DEVEDITION_66_0b4_BUILD1 DEVEDITION_66_0b4_RELEASE FIREFOX_66_0b4_BUILD1 FIREFOX_66_0b4_RELEASE
authorBas Schouten <bschouten@mozilla.com>
Thu, 31 Jan 2019 17:28:46 +0100
changeset 515664 a4da2c3de38fd19c313dd1ab8f8f10e847560012
parent 515663 e420e8059fe01b06f4cd77ecf9134036380f443b
child 515665 c17895dce486feb99080b7b8c00572f244207d28
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt, lizzard
bugs1521368
milestone66.0
Bug 1521368 - Part 2: Ensure destination DT is valid when replaying SourceSurfaceCapture. r=rhunt a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D18239
gfx/2d/SourceSurfaceCapture.cpp
--- a/gfx/2d/SourceSurfaceCapture.cpp
+++ b/gfx/2d/SourceSurfaceCapture.cpp
@@ -118,23 +118,23 @@ RefPtr<SourceSurface> SourceSurfaceCaptu
     data = static_cast<uint8_t*>(calloc(1, mSurfaceAllocationSize));
     if (!data) {
       return nullptr;
     }
     BackendType type = Factory::DoesBackendSupportDataDrawtarget(aBackendType)
                            ? aBackendType
                            : BackendType::SKIA;
     dt = Factory::CreateDrawTargetForData(type, data, mSize, mStride, mFormat);
-    if (!dt) {
+    if (!dt || !dt->IsValid()) {
       free(data);
       return nullptr;
     }
   }
 
-  if (!dt) {
+  if (!dt || !dt->IsValid()) {
     // Make sure we haven't allocated and aren't leaking something, the code
     // right anove here should have guaranteed that.
     MOZ_ASSERT(!data);
     return nullptr;
   }
 
   // If we're still attached to a DrawTarget, use its command list rather than
   // our own (which will be empty).