[cairo] [Patch] Make xlib-xcb register a hook for XCloseDisplay

Uli Schlachter psychon at znc.in
Sun Jul 3 09:34:14 PDT 2011


Hi list,

yesterday I ran cairo-test-suite -a -s on xlib-xcb. The result were lots of
weird errors and/or crashes. This happened because the Display* was closed and a
new one was opened which happened to have a xcb_connection_t with the same
address as the first display. The xcb backend thus assumed that this is still
the same connection and reused XIDs from its feelist which weren't really free
on this new connection.

Such problems don't happen with the XLib backend because it registers itself and
gets a callback from XCloseDisplay so that it can clean up. xlib-xcb should do
the same.

Attached is a commit which makes xlib-xcb have its own implementation of
cairo_device_t. These devices are used to decide if we already registers with Xlib.

The code for managing the device list is a copy&paste merge between the code in
cairo-xcb-connection.c and cairo-xlib-display.c plus some own changes. All bugs
are likely mine.
At first I wanted to re-use the existing code from the Xlib backend, but the
resulting #ifdef-hell was just too ugly to be used.

Feel free to point out any mistakes that you spot and all improvements that come
to your mind. If no one complaints, I'll push this as time permits.

Cheers,
Uli
-- 
The Angels have the phone box!


More information about the cairo mailing list