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

Carl Worth cworth at kemper.freedesktop.org
Tue Feb 13 23:49:35 PST 2007


 src/cairo-ft-font.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

New commits:
diff-tree 9966551dc7640ae7901ffed0e15f0fbf7e603d5d (from 7adab2866be21207a15f07aab01fb17edd0e661f)
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Feb 13 23:49:26 2007 -0800

    Fix cairo_ft_unscaled_font_t to have a lock_count again not an is_locked Boolean
    
    This was inadvertently changed as part of fdffde8b9e7a2308b822ddef7b02a8e85cc8ba1e
    
    With the Boolean, pango-using programs that locked the same
    unscaled_font multiple times would crash with a message such as:
    
     cairo-ft-font.c:569: _cairo_ft_unscaled_font_unlock_face: Assertion `unscaled->is_locked' failed.

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 0c2bb79..6791231 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -101,7 +101,7 @@ struct _cairo_ft_unscaled_font {
     FT_Matrix Current_Shape;
 
     cairo_mutex_t mutex;
-    cairo_bool_t is_locked;
+    int lock_count;
 
     cairo_ft_font_face_t *faces;	/* Linked list of faces for this font */
 };
@@ -335,7 +335,7 @@ _cairo_ft_unscaled_font_init (cairo_ft_u
 
     unscaled->have_scale = FALSE;
     CAIRO_MUTEX_INIT (&unscaled->mutex);
-    unscaled->is_locked = FALSE;
+    unscaled->lock_count = 0;
 
     unscaled->faces = NULL;
 
@@ -501,7 +501,7 @@ _has_unlocked_face (void *entry)
 {
     cairo_ft_unscaled_font_t *unscaled = entry;
 
-    return (! unscaled->is_locked && unscaled->face);
+    return (unscaled->lock_count == 0 && unscaled->face);
 }
 
 /* Ensures that an unscaled font has a face object. If we exceed
@@ -517,7 +517,7 @@ _cairo_ft_unscaled_font_lock_face (cairo
     FT_Face face = NULL;
 
     CAIRO_MUTEX_LOCK (unscaled->mutex);
-    unscaled->is_locked = TRUE;
+    unscaled->lock_count++;
 
     if (unscaled->face)
 	return unscaled->face;
@@ -566,9 +566,9 @@ slim_hidden_def (cairo_ft_scaled_font_lo
 void
 _cairo_ft_unscaled_font_unlock_face (cairo_ft_unscaled_font_t *unscaled)
 {
-    assert (unscaled->is_locked);
+    assert (unscaled->lock_count > 0);
 
-    unscaled->is_locked = FALSE;
+    unscaled->lock_count--;
 
     CAIRO_MUTEX_UNLOCK (unscaled->mutex);
 }


More information about the cairo-commit mailing list