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

Andrea Canciani ranma42 at kemper.freedesktop.org
Sat Jan 3 06:00:23 PST 2015


 src/cairo-font-face.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 02e4efc961be40d266d4df0acaf3271219529017
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Mon Dec 22 12:49:00 2014 +0100

    font: Actually perform destruction of fonts
    
    Commit 337ab1f8d9e29086bfb4001508b28835b41c6390 introduced delayed
    font destruction to overcome a race, but prevented the correct cleanup
    of the font cache.
    
    This caused fonts to stay in the cache and caused a crash in the
    api-special-cases (when running the test suite with -f).
    
    Fixes api-special-cases,
    https://bugs.freedesktop.org/show_bug.cgi?id=87567

diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c
index e32a9bb..3bcd2a1 100644
--- a/src/cairo-font-face.c
+++ b/src/cairo-font-face.c
@@ -128,7 +128,8 @@ cairo_font_face_reference (cairo_font_face_t *font_face)
 }
 slim_hidden_def (cairo_font_face_reference);
 
-static inline int __put(cairo_reference_count_t *v)
+static inline cairo_bool_t
+__put(cairo_reference_count_t *v)
 {
     int c, old;
 
@@ -136,7 +137,7 @@ static inline int __put(cairo_reference_count_t *v)
     while (c != 1 && (old = _cairo_atomic_int_cmpxchg_return_old(&v->ref_count, c, c - 1)) != c)
 	c = old;
 
-    return c;
+    return c != 1;
 }
 
 cairo_bool_t


More information about the cairo-commit mailing list