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

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Wed Jul 9 13:06:30 PDT 2008


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

New commits:
commit e534b0bed1bcf19017f76ee3a15bb26f42717b50
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Wed Jul 9 13:06:23 2008 -0700

    [quartz] Protect against NULL from CGFontGetHMetricsPtr
    
    Seems to happen on 10.4 only for unknown reasons.  Protect against a crash at least.

diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
index ee5e52b..c4df88a 100644
--- a/src/cairo-quartz-font.c
+++ b/src/cairo-quartz-font.c
@@ -188,6 +188,12 @@ _cairo_quartz_font_face_scaled_font_create (void *abstract_face,
 	quartz_CGFontMetrics *m;
 	m = CGFontGetHMetricsPtr (font_face->cgFont);
 
+	/* On OX 10.4, GetHMetricsPtr sometimes returns NULL for unknown reasons */
+	if (!m) {
+	    status = _cairo_error(CAIRO_STATUS_NULL_POINTER);
+	    goto FINISH;
+	}
+
 	fs_metrics.ascent = (m->ascent / ems);
 	fs_metrics.descent = - (m->descent / ems);
 	fs_metrics.height = fs_metrics.ascent + fs_metrics.descent + (m->leading / ems);


More information about the cairo-commit mailing list