[cairo] Fix a crash in _cairo_xlib_surface_show_glyphs

Jinghua Luo sunmoon1997 at gmail.com
Sun May 27 00:12:51 PDT 2007


hi,
  After introducing a work queue for deferred destruction of X resource, 
my firefox crashes over and over again while surfing the same page as 
before. The backtrace shows the problem is we're double freeing a glyph.
To identify the problem, I add a printf just before XRenderAddGlyphs and 
XRenerFreeGlyphs and extract following sequence:

XRenderAddGlyphs (20990204, 20069)
XRenderFreeGlyphs (20990204, 20069)
XRenderAddGlyphs (20990204, 20069)
XRenderAddGlyphs (20990204, 20069)
XRenderFreeGlyphs (20990204, 20069)
XRenderFreeGlyphs (20990204, 20069)

The sequence is out of order, obviously we'll crash at the last 
XRenderFreeGlyphs. It seems the problem while we send glyphs to server 
some pending XRenderFreeGlyphs works may be still in current display's 
work queue then if we destroy the glyph again, we'll get a similar 
sequence as above. To resolve the problem, we must be ensure there's no
pending work to free the glyph that we want to sent. The attached patch 
fixes the problem for me which I'd like to commit.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xlib-surface-flush-workqueue-before-sending-glyph.patch
Type: text/x-patch
Size: 444 bytes
Desc: not available
Url : http://cairographics.org/archives/cairo/attachments/20070527/18ffa7fc/attachment.bin 


More information about the cairo mailing list