summaryrefslogtreecommitdiff
path: root/src/cairo-scaled-font.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-18 16:06:28 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-18 16:08:27 +0100
commit519dff51db30e157f52ef5244a3afeea06340ff8 (patch)
tree374b60c9f9c8bdf12529b0ec33d1a9229ffbb51a /src/cairo-scaled-font.c
parentdf1ca22ada340add2360677ff892ec043dad96f4 (diff)
scaled-font: Prevent a recursive mutex lock for removing a failed glyph
If we fail to create a glyph, and it is the only one in the glyph page, we then pluck that page out of the global glyph cache. The cache destroy callback tries to take the scaled_font lock again, causing a lockup. Rework the error path to avoid taking that lock in this case - still a potential lock ordering issue remains. 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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 97460c2cb..ac80c97d1 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -2905,8 +2905,12 @@ _cairo_scaled_font_free_last_glyph (cairo_scaled_font_t *scaled_font,
if (--page->num_glyphs == 0) {
CAIRO_MUTEX_LOCK (_cairo_scaled_glyph_page_cache_mutex);
+ /* Temporarily disconnect callback to avoid recursive locking */
+ cairo_scaled_glyph_page_cache.entry_destroy = NULL;
_cairo_cache_remove (&cairo_scaled_glyph_page_cache,
&page->cache_entry);
+ _cairo_scaled_glyph_page_destroy (scaled_font, page);
+ cairo_scaled_glyph_page_cache.entry_destroy = _cairo_scaled_glyph_page_pluck;
CAIRO_MUTEX_UNLOCK (_cairo_scaled_glyph_page_cache_mutex);
}
}