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

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Sat Sep 9 20:58:56 PDT 2006


 src/cairo-scaled-font.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

New commits:
diff-tree 5ab72579ef2a9fce1aedf3068825ccba683b6e79 (from d3076a1843bc2f05bab0df913d0c27f125bea162)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Sat Sep 9 19:52:48 2006 -0700

    Correctly acquire/release mutex in _cairo_scaled_font_map_destroy
    
    _cairo_scaled_font_map_destroy needs to both lock/unlock the mutex,
    not just unlock it.

diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
old mode 100644
new mode 100755
index 3f028db..700f209
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -226,13 +226,15 @@ void
 _cairo_scaled_font_map_destroy (void)
 {
     int i;
-    cairo_scaled_font_map_t *font_map = cairo_scaled_font_map;
+    cairo_scaled_font_map_t *font_map;
     cairo_scaled_font_t *scaled_font;
 
-    if (font_map == NULL)
-	return;
+    CAIRO_MUTEX_LOCK (cairo_scaled_font_map_mutex);
 
-    CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex);
+    font_map = cairo_scaled_font_map;
+    if (font_map == NULL) {
+        goto CLEANUP_MUTEX_LOCK;
+    }
 
     for (i = 0; i < font_map->num_holdovers; i++) {
 	scaled_font = font_map->holdovers[i];
@@ -250,6 +252,9 @@ _cairo_scaled_font_map_destroy (void)
 
     free (cairo_scaled_font_map);
     cairo_scaled_font_map = NULL;
+
+ CLEANUP_MUTEX_LOCK:
+    CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex);
 }
 
 /* Fowler / Noll / Vo (FNV) Hash (http://www.isthe.com/chongo/tech/comp/fnv/)


More information about the cairo-commit mailing list