mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-19 06:40:38 +02:00
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.
(cherry picked from commit 9f4e643649)
This commit is contained in:
parent
578e38eaa7
commit
c8aff910c4
1 changed files with 9 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue