From 29099d481c4fe28ba583fcdd2219fa35c674ca08 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Tue, 14 Nov 2017 23:15:31 -0500 Subject: [PATCH] Bug 1416607 - error when Moz2DImageRenderer fails to create a NativeFontResource or UnscaledFont. r=jrmuizel MozReview-Commit-ID: Jool723LUFX --- gfx/webrender_bindings/Moz2DImageRenderer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gfx/webrender_bindings/Moz2DImageRenderer.cpp b/gfx/webrender_bindings/Moz2DImageRenderer.cpp index b84f2e3c829c..35129e5e9ec2 100644 --- a/gfx/webrender_bindings/Moz2DImageRenderer.cpp +++ b/gfx/webrender_bindings/Moz2DImageRenderer.cpp @@ -8,6 +8,7 @@ #include "mozilla/Range.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/InlineTranslator.h" +#include "mozilla/gfx/Logging.h" #include "mozilla/gfx/RecordedEvent.h" #include "WebRenderTypes.h" #include "webrender_ffi.h" @@ -124,10 +125,15 @@ GetUnscaledFont(Translator *aTranslator, wr::FontKey key) { type, aTranslator->GetFontContext()); RefPtr unscaledFont; - if (fontResource) { + if (!fontResource) { + gfxDevCrash(LogReason::NativeFontResourceNotFound) << "Failed to creative NativeFontResource for FontKey " << key.mHandle; + } else { // Instance data is only needed for GDI fonts which webrender does not // support. unscaledFont = fontResource->CreateUnscaledFont(data.mIndex, nullptr, 0); + if (!unscaledFont) { + gfxDevCrash(LogReason::UnscaledFontNotFound) << "Failed to create UnscaledFont for FontKey " << key.mHandle; + } } data.mUnscaledFont = unscaledFont; return unscaledFont;