bug 880818 - check for failure when creating the cairo_scaled_font in gfxFT2Font::GetOrMakeFont. r=jdaggett
authorJonathan Kew <jkew@mozilla.com>
Fri, 09 Aug 2013 09:51:51 +0100
changeset 141859 90943a435604cedd8d1ef75ee545283d3dff7ec8
parent 141858 80c3c00e0b3c087fc2b0ce81c50fe898b5d240ca
child 141860 c8069eb3a8754d0a4c013e1db588716b3df005e8
push id32257
push userjkew@mozilla.com
push dateFri, 09 Aug 2013 08:53:41 +0000
treeherdermozilla-inbound@c8069eb3a875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs880818
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 880818 - check for failure when creating the cairo_scaled_font in gfxFT2Font::GetOrMakeFont. r=jdaggett
gfx/thebes/gfxFT2Fonts.cpp
--- a/gfx/thebes/gfxFT2Fonts.cpp
+++ b/gfx/thebes/gfxFT2Fonts.cpp
@@ -586,20 +586,24 @@ gfxFT2Font::GetOrMakeFont(const nsAStrin
 
 already_AddRefed<gfxFT2Font>
 gfxFT2Font::GetOrMakeFont(FT2FontEntry *aFontEntry, const gfxFontStyle *aStyle,
                           bool aNeedsBold)
 {
     nsRefPtr<gfxFont> font = gfxFontCache::GetCache()->Lookup(aFontEntry, aStyle);
     if (!font) {
         cairo_scaled_font_t *scaledFont = aFontEntry->CreateScaledFont(aStyle);
+        if (!scaledFont) {
+            return nullptr;
+        }
         font = new gfxFT2Font(scaledFont, aFontEntry, aStyle, aNeedsBold);
         cairo_scaled_font_destroy(scaledFont);
-        if (!font)
+        if (!font) {
             return nullptr;
+        }
         gfxFontCache::GetCache()->AddNew(font);
     }
     return font.forget().downcast<gfxFT2Font>();
 }
 
 void
 gfxFT2Font::FillGlyphDataForChar(uint32_t ch, CachedGlyphData *gd)
 {