Bug 736276 - Ensure we can never double addref a cairo scaled font in ScaledFontBase r=mattwoodrow

This commit is contained in:
George Wright 2013-06-28 22:50:59 -04:00
parent 050d2d58af
commit d2b4508586
2 changed files with 7 additions and 1 deletions

View File

@ -112,6 +112,12 @@ ScaledFontBase::SetCairoScaledFont(cairo_scaled_font_t* font)
{
MOZ_ASSERT(!mScaledFont);
if (font == mScaledFont)
return;
if (mScaledFont)
cairo_scaled_font_destroy(mScaledFont);
mScaledFont = font;
cairo_scaled_font_reference(mScaledFont);
}

View File

@ -35,7 +35,7 @@ namespace gfx {
ScaledFontCairo::ScaledFontCairo(cairo_scaled_font_t* aScaledFont, Float aSize)
: ScaledFontBase(aSize)
{
mScaledFont = aScaledFont;
SetCairoScaledFont(aScaledFont);
}
#if defined(USE_SKIA) && defined(MOZ_ENABLE_FREETYPE)