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

Chris Wilson ickle at kemper.freedesktop.org
Tue Dec 14 12:47:17 PST 2010


 src/cairo-scaled-font.c |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit f10b3105d3e662616ce2ee928776cac73f536d94
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Dec 13 16:25:58 2010 +0000

    scaled-font: assert that we hold the scaled-font mutex when looking up glyphs
    
    Holding the mutex over glyph lookup not only prevents multi-threaded
    races between insertion and deletion that spell disaster for memory
    integrity, but also implies that the glyph cache is frozen.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 70ecda2..2702877 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -2793,6 +2793,8 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
     if (unlikely (scaled_font->status))
 	return scaled_font->status;
 
+    assert (CAIRO_MUTEX_IS_LOCKED(scaled_font->mutex));
+
     if (CAIRO_INJECT_FAULT ())
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 


More information about the cairo-commit mailing list