Bug 1189715: Wallpaper over the crash by making sure the draw target is valid. r?lsalzman draft
authorMilan Sreckovic <milan@mozilla.com>
Thu, 24 Mar 2016 13:22:28 -0400
changeset 344446 b9f3f0582fe30c632a5e34273d61dcad939175ed
parent 344388 24c5fbde4488e06ef79905e1c520027cddcd1189
child 516952 39bb5fa1925b26b8a7d75cef3c018a1914956290
push id13822
push usermsreckovic@mozilla.com
push dateThu, 24 Mar 2016 17:30:50 +0000
reviewerslsalzman
bugs1189715
milestone48.0a1
Bug 1189715: Wallpaper over the crash by making sure the draw target is valid. r?lsalzman MozReview-Commit-ID: Hy9kTMRuNjY
layout/base/nsPresShell.cpp
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -2882,16 +2882,20 @@ PresShell::ClearFrameRefs(nsIFrame* aFra
 }
 
 already_AddRefed<gfxContext>
 PresShell::CreateReferenceRenderingContext()
 {
   nsDeviceContext* devCtx = mPresContext->DeviceContext();
   RefPtr<gfxContext> rc;
   if (mPresContext->IsScreen()) {
+    if (!gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget() ||
+        !gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()->IsValid()) {
+      return nullptr;
+    }
     rc = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
   } else {
     // We assume the devCtx has positive width and height for this call.
     // However, width and height, may be outside of the reasonable range
     // so rc may still be null.
     rc = devCtx->CreateRenderingContext();
     if (!rc) {
       return nullptr;