[cairo] Cairo 1.4.8 and X11 creates X11 erros

Chris Wilson chris at chris-wilson.co.uk
Sat Jun 23 06:17:25 PDT 2007

Tim Teulings (rael at edge.ping.de) said: 
> I have a fairly big library using cairo. The combination of my GUI 
> library, X11, gtk and cairo worked very well until cairo 1.4.6 (Debian 
> unstable).
> However with cairo 1.4.8 I get X11 crashes.
> The problems seems to appear after closing sub windows of my 
> application, resulting a freeing and allocation of X11, and cairo resources.

Sadly this was a flaw in the deferred X11 resource cleanup work - I had
not anticipated that X would perform garbage collection of all
associated resources when destroying Drawables. So when you destroy a
Window, the server frees the Picture that cairo has queued for
destruction during _cairo_xlib_surface_finish() and so when cairo runs
the workqueue it triggers an XError as it tries to double free the

At the moment, git has a band-aid applied that installs a no-op error
handler whilst the workqueue runs. However this requires XSyncs for
correct operation and so xlib performance with the patch is abysmal.
Currently under investigation is whether we can avoid deferring
operations for surfaces that are associated with the application's
drawables. This should still protect cairo from the threading issues
surrounding the caching of solid surfaces, but sacrifices the same
guarantee for external Drawables.

What makes the problem even more galling is that the bug is triggered
during make check! (The XError was swallowed by another no-op
error handler and was not reported.)

Chris Wilson

More information about the cairo mailing list