diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-08 13:35:43 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-08 15:03:06 +0000 |
commit | c4ea7b13b406bf0ea1dc9b337010131d3704bc4a (patch) | |
tree | 3950956ab522c0846e22c4e4dcda540d4db121fc /src/cairo-scaled-font.c | |
parent | 4d4bf8fddff49d349e03282ffa827f6f4659e3fe (diff) | |
download | cairo-c4ea7b13b406bf0ea1dc9b337010131d3704bc4a.tar.gz |
scaled-font: Assert if attempting to finish a frozen font
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-scaled-font.c')
-rw-r--r-- | src/cairo-scaled-font.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c index d4eef5575..ac8dc0a88 100644 --- a/src/cairo-scaled-font.c +++ b/src/cairo-scaled-font.c @@ -780,6 +780,7 @@ _cairo_scaled_font_freeze_cache (cairo_scaled_font_t *scaled_font) { /* ensure we do not modify an error object */ assert (scaled_font->status == CAIRO_STATUS_SUCCESS); + assert (! scaled_font->cache_frozen); CAIRO_MUTEX_LOCK (scaled_font->mutex); scaled_font->cache_frozen = TRUE; @@ -788,6 +789,7 @@ _cairo_scaled_font_freeze_cache (cairo_scaled_font_t *scaled_font) void _cairo_scaled_font_thaw_cache (cairo_scaled_font_t *scaled_font) { + assert (scaled_font->cache_frozen); scaled_font->cache_frozen = FALSE; if (scaled_font->global_cache_frozen) { @@ -867,6 +869,8 @@ _cairo_scaled_font_fini_pages (cairo_scaled_font_t *scaled_font) static void _cairo_scaled_font_fini_internal (cairo_scaled_font_t *scaled_font) { + assert (! scaled_font->cache_frozen); + assert (! scaled_font->global_cache_frozen); scaled_font->finished = TRUE; _cairo_scaled_font_fini_pages (scaled_font); @@ -1158,6 +1162,8 @@ cairo_scaled_font_create (cairo_font_face_t *font_face, * ft-font-faces */ assert (scaled_font->font_face == font_face); + assert (! scaled_font->cache_frozen); + assert (! scaled_font->global_cache_frozen); scaled_font->original_font_face = cairo_font_face_reference (original_font_face); @@ -1307,6 +1313,9 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font) if (! _cairo_reference_count_dec_and_test (&scaled_font->ref_count)) return; + assert (! scaled_font->cache_frozen); + assert (! scaled_font->global_cache_frozen); + font_map = _cairo_scaled_font_map_lock (); assert (font_map != NULL); @@ -2825,6 +2834,8 @@ _cairo_scaled_font_allocate_glyph (cairo_scaled_font_t *scaled_font, cairo_scaled_glyph_page_t *page; cairo_status_t status; + assert (scaled_font->cache_frozen); + /* only the first page in the list may contain available slots */ if (! cairo_list_is_empty (&scaled_font->glyph_pages)) { page = cairo_list_last_entry (&scaled_font->glyph_pages, @@ -2942,6 +2953,7 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font, return scaled_font->status; assert (CAIRO_MUTEX_IS_LOCKED(scaled_font->mutex)); + assert (scaled_font->cache_frozen); if (CAIRO_INJECT_FAULT ()) return _cairo_error (CAIRO_STATUS_NO_MEMORY); |