summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-display.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2007-08-21 10:03:00 -0700
committerCarl Worth <cworth@cworth.org>2007-08-21 16:46:58 -0700
commit9f4e6436496fe561aa124bb2b89e1c6711684d98 (patch)
tree8cb53f205cf67c4605e1186e1cc55a213667dee1 /src/cairo-xlib-display.c
parentd05593a5fb9fef586171cb9973a9942a105d50d7 (diff)
Ensure the Render extension is initialized before calling XESetCloseDisplay
This avoids a potential crash from the Render extension being cleaned up during XCloseDisplay before the cairo CloseDisplay hook goes on to call into XRenderFreePicture.
Diffstat (limited to 'src/cairo-xlib-display.c')
-rw-r--r--src/cairo-xlib-display.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c
index c7c3c43c..b8f35cb8 100644
--- a/src/cairo-xlib-display.c
+++ b/src/cairo-xlib-display.c
@@ -226,6 +226,7 @@ _cairo_xlib_display_get (Display *dpy)
cairo_xlib_display_t *display;
cairo_xlib_display_t **prev;
XExtCodes *codes;
+ int major_unused, minor_unused;
/* There is an apparent deadlock between this mutex and the
* mutex for the display, but it's actually safe. For the
@@ -260,6 +261,14 @@ _cairo_xlib_display_get (Display *dpy)
if (display == NULL)
goto UNLOCK;
+ /* Xlib calls out to the extension close_display hooks in LIFO
+ * order. So we have to ensure that all extensions that we depend
+ * on in our close_display hook are properly initialized before we
+ * add our hook. For now, that means Render, so we call into its
+ * QueryVersion function to ensure it gets initialized.
+ */
+ XRenderQueryVersion (dpy, &major_unused, &minor_unused);
+
codes = XAddExtension (dpy);
if (codes == NULL) {
free (display);