summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-08 14:56:07 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-08 15:02:27 +0000
commit4d4bf8fddff49d349e03282ffa827f6f4659e3fe (patch)
tree0ebdc38ed5bcb61afb083bd27af930ae7efe16e8
parent44a093eb95c950b0e8f2d7d1cdb9719cb8a550f7 (diff)
downloadcairo-4d4bf8fddff49d349e03282ffa827f6f4659e3fe.tar.gz
scaled-font: Free the cached glyphs from the font before taking the global lock
In the case of a recording surface we may recurse into the global glyph cache so we need to be careful and stage the ordering of how we free the glyphs. So first we finish any information and surfaces from the scaled font glyph cache (and so triggering recursion into other scaled fonts) and then take the global cache and remove our pages. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54950 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/cairo-scaled-font.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 9b0fc9238..d4eef5575 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -846,11 +846,30 @@ _cairo_scaled_font_set_metrics (cairo_scaled_font_t *scaled_font,
}
static void
+_cairo_scaled_font_fini_pages (cairo_scaled_font_t *scaled_font)
+{
+ cairo_scaled_glyph_page_t *page;
+ unsigned int i;
+
+ cairo_list_foreach_entry (page, cairo_scaled_glyph_page_t,
+ &scaled_font->glyph_pages, link) {
+ for (i = 0; i < page->num_glyphs; i++) {
+ _cairo_hash_table_remove (scaled_font->glyphs,
+ &page->glyphs[i].hash_entry);
+ _cairo_scaled_glyph_fini (scaled_font, &page->glyphs[i]);
+ }
+ page->num_glyphs = 0;
+ }
+
+ _cairo_scaled_font_reset_cache (scaled_font);
+}
+
+static void
_cairo_scaled_font_fini_internal (cairo_scaled_font_t *scaled_font)
{
scaled_font->finished = TRUE;
- _cairo_scaled_font_reset_cache (scaled_font);
+ _cairo_scaled_font_fini_pages (scaled_font);
_cairo_hash_table_destroy (scaled_font->glyphs);
cairo_font_face_destroy (scaled_font->font_face);