[cairo-commit] 2 commits - src/cairo-ft-font.c test/fallback-resolution.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jun 29 02:52:38 PDT 2009


 src/cairo-ft-font.c        |    3 +--
 test/fallback-resolution.c |    3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 6102dd0c1c26e289ad08d1cf0cc366e6298f5711
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 29 10:50:44 2009 +0100

    [ft] Correct reference counting for implementation font face
    
    We are expected to return a new reference from get_implementation(), and
    failing to do so was causing use-after-frees (detected by the reference
    counting checks).

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index d66732f..6c6ff59 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -2332,10 +2332,9 @@ _cairo_ft_font_face_get_implementation (void                     *abstract_face,
 	    }
 
 	    if (font_face->resolved_config == FcConfigGetCurrent ())
-		return resolved;
+		return cairo_font_face_reference (resolved);
 
 	    cairo_font_face_destroy (resolved);
-	    font_face->resolved_font_face = NULL;
 	}
 
 	resolved = _cairo_ft_resolve_pattern (font_face->pattern,
commit 4f745fbe3329a4fd5164c7bd7fe61c0395e8d1ee
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 29 10:49:51 2009 +0100

    [test] Only run fallback-resolution for enabled targets
    
    A secondary check that both activates CAIRO_TEST_TARGET and prevents a
    NULL-deref with the null test surface.

diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index eab7995..f5fcf07 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -354,6 +354,9 @@ preamble (cairo_test_context_t *ctx)
 	if (! target->is_vector)
 	    continue;
 
+	if (! cairo_test_is_target_enabled (ctx, target->name))
+	    continue;
+
 	format = cairo_boilerplate_content_name (target->content);
 	xasprintf (&base_name, "fallback-resolution.%s.%s",
 		   target->name,


More information about the cairo-commit mailing list