Bug 1189715: Wallpaper over the crash by making sure the draw target is valid. r?lsalzman
MozReview-Commit-ID: Hy9kTMRuNjY
--- 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;