From 693fff053b40919c4f7619bba45d16719568c76e Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Thu, 11 Feb 2016 22:15:11 +0100 Subject: [PATCH] Bug 1247380: Only copy the background if we can succesfully get a snapshot. r=jrmuizel MozReview-Commit-ID: uWH7MtJmSp --- gfx/thebes/gfxContext.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp index a3309268b25e..5961abdef44e 100644 --- a/gfx/thebes/gfxContext.cpp +++ b/gfx/thebes/gfxContext.cpp @@ -854,9 +854,11 @@ gfxContext::PushGroupAndCopyBackground(gfxContentType content, Float aOpacity, S mDT->PushLayer(content == gfxContentType::COLOR, aOpacity, aMask, aMaskTransform, IntRect(), false); } } else { - if (pushOpaqueWithCopiedBG) { + RefPtr source; + // This snapshot can be nullptr if the DrawTarget is a cairo target that is currently + // in an error state. + if (pushOpaqueWithCopiedBG && (source = mDT->Snapshot())) { DrawTarget *oldDT = mDT; - RefPtr source = mDT->Snapshot(); Point oldDeviceOffset = CurrentState().deviceOffset; PushNewDT(gfxContentType::COLOR);