[cairo-commit] src/cairo-quartz-font.c

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Sun Apr 27 15:20:50 PDT 2008


 src/cairo-quartz-font.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 122a31a0757d0483f72af0cf3816a52bded5afb6
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Sun Apr 27 15:20:43 2008 -0700

    [quartz] Fix CGFont leaks when creating quartz fonts
    
    The toy font constructor and the _with_atsu_font_id constructor were
    not properly managing the refcount of the CGFontRef.

diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
index 2918ea7..4a59d67 100644
--- a/src/cairo-quartz-font.c
+++ b/src/cairo-quartz-font.c
@@ -343,6 +343,8 @@ _cairo_quartz_font_create_toy(cairo_toy_font_face_t *toy_face,
     }
 
     face = cairo_quartz_font_face_create_for_cgfont (cgFont);
+    CGFontRelease (cgFont);
+
     if (face->status)
 	return face->status;
 
@@ -780,8 +782,13 @@ cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id)
 {
     ATSFontRef atsFont = FMGetATSFontRefFromFont (font_id);
     CGFontRef cgFont = CGFontCreateWithPlatformFont (&atsFont);
+    cairo_font_face_t *ff;
+
+    ff = cairo_quartz_font_face_create_for_cgfont (cgFont);
+
+    CGFontRelease (cgFont);
 
-    return cairo_quartz_font_face_create_for_cgfont (cgFont);
+    return ff;
 }
 
 /* This is the old name for the above function, exported for compat purposes */


More information about the cairo-commit mailing list