From 4da50dfa02d7c03c32ee20c15f8304eafa0844e0 Mon Sep 17 00:00:00 2001 From: Luo jinghua Date: Sun, 27 May 2007 17:09:49 +0800 Subject: [PATCH] [cairo-xlib-surface]: flush work queue before sending glyphs to X server. After introducing a work queue for deferred destruction of X resource my firefox crashes over and over again because XRenderFreeGlyphs is trying to free a non-exist glyph (already freed). The problematic call sequence is something like below: XRenderAddGlyphs (20990204, 20069) XRenderAddGlyphs (20990204, 20069) XRenderFreeGlyphs (20990204, 20069) XRenderFreeGlyphs (20990204, 20069) You can see the two add/free glyphs is interlaced. And obviously, we'll crash at the last one. To fix this bug, we must be ensure here's no pending work to free the glyph that we want to sent. --- src/cairo-xlib-surface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 103757bcd..db5c15540 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -2887,6 +2887,7 @@ _cairo_xlib_surface_emit_glyphs (cairo_xlib_surface_t *dst, int request_size = 0; _cairo_xlib_surface_ensure_dst_picture (dst); + _cairo_xlib_display_notify (dst->screen_info->display); for (i = 0; i < num_glyphs; i++) { int this_x, this_y;