Index: ChangeLog =================================================================== RCS file: /mirrors/freedesktop/cairo/cairo/ChangeLog,v retrieving revision 1.1026.2.7 diff -u -p -r1.1026.2.7 ChangeLog --- ChangeLog 13 Sep 2005 19:38:06 -0000 1.1026.2.7 +++ ChangeLog 13 Sep 2005 22:30:43 -0000 @@ -1,5 +1,11 @@ 2005-09-13 Carl Worth + * src/cairo-ft-font.c: (_cairo_ft_scaled_font_text_to_glyphs): + Expand locking to include all modification of cairo_scaled_font + and related objects. + +2005-09-13 Carl Worth + * test/pthread-show-text.c: (start), (main): Adjust parameters to stress things a bit more, (better exposing another locking bug). Index: src/cairo-ft-font.c =================================================================== RCS file: /mirrors/freedesktop/cairo/cairo/src/cairo-ft-font.c,v retrieving revision 1.110 diff -u -p -r1.110 cairo-ft-font.c --- src/cairo-ft-font.c 24 Aug 2005 02:52:09 -0000 1.110 +++ src/cairo-ft-font.c 13 Sep 2005 22:29:10 -0000 @@ -1648,29 +1648,27 @@ _cairo_ft_scaled_font_text_to_glyphs (vo cairo_cache_t *cache = NULL; cairo_status_t status = CAIRO_STATUS_SUCCESS; + _cairo_lock_global_image_glyph_cache (); + cache = _cairo_get_global_image_glyph_cache (); + if (cache == NULL) + return CAIRO_STATUS_NO_MEMORY; + _cairo_ft_scaled_font_get_glyph_cache_key (scaled_font, &key); status = _cairo_utf8_to_ucs4 ((unsigned char*)utf8, -1, &ucs4, num_glyphs); if (status) - return status; + goto CLEANUP_CACHE; face = cairo_ft_scaled_font_lock_face (&scaled_font->base); if (!face) { status = CAIRO_STATUS_NO_MEMORY; - goto FAIL1; - } - - _cairo_lock_global_image_glyph_cache (); - cache = _cairo_get_global_image_glyph_cache (); - if (cache == NULL) { - status = CAIRO_STATUS_NO_MEMORY; - goto FAIL2; + goto CLEANUP_UCS4; } *glyphs = (cairo_glyph_t *) malloc ((*num_glyphs) * (sizeof (cairo_glyph_t))); if (*glyphs == NULL) { status = CAIRO_STATUS_NO_MEMORY; - goto FAIL2; + goto CLEANUP_SCALED_FONT_LOCK_FACE; } for (i = 0; i < *num_glyphs; i++) @@ -1690,15 +1688,16 @@ _cairo_ft_scaled_font_text_to_glyphs (vo y += val->extents.y_advance; } - FAIL2: - if (cache) - _cairo_unlock_global_image_glyph_cache (); - + CLEANUP_SCALED_FONT_LOCK_FACE: cairo_ft_scaled_font_unlock_face (&scaled_font->base); - FAIL1: + CLEANUP_UCS4: free (ucs4); - + + CLEANUP_CACHE: + if (cache) + _cairo_unlock_global_image_glyph_cache (); + return status; }