summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2005-09-13 15:41:16 +0000
committerCarl Worth <cworth@cworth.org>2005-09-13 15:41:16 +0000
commita85f9916a9743d83c8a71586dfa1d64f85f52ea7 (patch)
tree180b2af67cbc8518e1ca856747a029770106793d
parent4a078039192a57df54f258fe6ff7c1e9a9bbb613 (diff)
Expand locking to include all modification of cairo_scaled_font and related objects.
-rw-r--r--ChangeLog6
-rw-r--r--src/cairo-ft-font.c31
2 files changed, 21 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 41e1a8843..956147bf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2005-09-13 Carl Worth <cworth@cworth.org>
+ * 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 <cworth@cworth.org>
+
* test/pthread-show-text.c: (start), (main): Adjust parameters to
stress things a bit more, (better exposing another locking bug).
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index bcc66580d..2d04e361b 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1648,29 +1648,27 @@ _cairo_ft_scaled_font_text_to_glyphs (void *abstract_font,
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 (void *abstract_font,
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;
}