summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-04-23 20:14:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-04-23 20:15:44 +0100
commit887d43578c3acc7d45c8b2e3ade5da29be804eeb (patch)
tree7ad9b2a20c0654b9a671c03ee018f669abfd3c8d
parentc63e3490a5fc2836837e7adcb5ecad62bdfd18ab (diff)
xlib: Simply release the ref, not destroy, from CloseDisplay.
Do not call the destroy function directly, but rely on the reference counting to call the notifier upon the last reference. Instead, simply release the reference we were holding for the cache and CloseDisplay callback.
-rw-r--r--src/cairo-xlib-display.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c
index be65c227..b0a58280 100644
--- a/src/cairo-xlib-display.c
+++ b/src/cairo-xlib-display.c
@@ -205,15 +205,15 @@ _cairo_xlib_close_display (Display *dpy, XExtCodes *codes)
XSync (dpy, False);
old_handler = XSetErrorHandler (_noop_error_handler);
- if (cairo_device_acquire (&display->base))
- return 0;
- _cairo_xlib_display_notify (display);
- _cairo_xlib_call_close_display_hooks (display);
- _cairo_xlib_display_discard_screens (display);
-
- /* catch any that arrived before marking the display as closed */
- _cairo_xlib_display_notify (display);
- cairo_device_release (&display->base);
+ if (cairo_device_acquire (&display->base)) {
+ _cairo_xlib_display_notify (display);
+ _cairo_xlib_call_close_display_hooks (display);
+ _cairo_xlib_display_discard_screens (display);
+
+ /* catch any that arrived before marking the display as closed */
+ _cairo_xlib_display_notify (display);
+ cairo_device_release (&display->base);
+ }
XSync (dpy, False);
XSetErrorHandler (old_handler);
@@ -234,7 +234,9 @@ _cairo_xlib_close_display (Display *dpy, XExtCodes *codes)
CAIRO_MUTEX_UNLOCK (_cairo_xlib_display_mutex);
assert (display != NULL);
- _cairo_xlib_display_destroy (display);
+
+ cairo_device_finish (&display->base);
+ cairo_device_destroy (&display->base);
/* Return value in accordance with requirements of
* XESetCloseDisplay */