From 65ff5bf8cbcca8b4b93c0d16be172ad4b8bff440 Mon Sep 17 00:00:00 2001 From: romashin Date: Sat, 19 Apr 2008 18:40:37 +0300 Subject: [PATCH] Added cairoFontface destroy --- gfx/thebes/src/gfxQtFonts.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gfx/thebes/src/gfxQtFonts.cpp b/gfx/thebes/src/gfxQtFonts.cpp index 7d25eaaca9bf..bc7d9dadf1de 100644 --- a/gfx/thebes/src/gfxQtFonts.cpp +++ b/gfx/thebes/src/gfxQtFonts.cpp @@ -430,8 +430,18 @@ gfxQtFont::gfxQtFont(const nsAString &aName, gfxQtFont::~gfxQtFont() { - delete mQFont; - cairo_scaled_font_destroy(mCairoFont); + if (mQFont) { + delete mQFont; + } + if (mCairoFont) { + cairo_scaled_font_destroy(mCairoFont); + } + if (mFontFace) { + cairo_font_face_destroy(mFontFace); + } + mQFont = nsnull; + mCairoFont = nsnull; + mFontFace = nsnull; } // rounding and truncation functions for a Freetype floating point number @@ -696,8 +706,8 @@ gfxQtFont::CreateScaledFont(cairo_t *aCR, cairo_matrix_t *aCTM, QFont &aQFont) cairo_font_options_t *fontOptions = cairo_font_options_create(); cairo_scaled_font_t* scaledFont = - cairo_scaled_font_create( CairoFontFace(&aQFont), -// cairo_scaled_font_create( CairoFontFace(), // This makes fonts working almost perfect +// cairo_scaled_font_create( CairoFontFace(&aQFont), + cairo_scaled_font_create( CairoFontFace(), // This makes fonts working almost perfect &fontMatrix, aCTM, fontOptions);