Bug 1521368 - Part 2: Ensure destination DT is valid when replaying SourceSurfaceCapture. r=rhunt
authorBas Schouten <bschouten@mozilla.com>
Thu, 31 Jan 2019 17:28:46 +0100
changeset 514148 afa70e5e516a
parent 514147 36d028f5018e
child 514208 83598ee9b2e8
child 514215 6b6fd6d6d2f3
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1521368
milestone67.0a1
first release with
nightly linux32
afa70e5e516a / 67.0a1 / 20190131214909 / files
nightly linux64
afa70e5e516a / 67.0a1 / 20190131214909 / files
nightly mac
afa70e5e516a / 67.0a1 / 20190131214909 / files
nightly win32
afa70e5e516a / 67.0a1 / 20190131214909 / files
nightly win64
afa70e5e516a / 67.0a1 / 20190131214909 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1521368 - Part 2: Ensure destination DT is valid when replaying SourceSurfaceCapture. r=rhunt 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).