summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-06-27 10:53:29 -0700
committerCarl Worth <cworth@cworth.org>2007-06-27 10:53:29 -0700
commit0791f342b93225849d9171aac8b738014b18bdf5 (patch)
treedf19b02d20a3d928e1a6a1a96e2678dcc61be520 /src
parentfea4f344c46cf5f85c6af3102333008768c55063 (diff)
Avoid deferring resource cleanup for application drawables
This eliminates X errors propagated from cairo due to cleaning up Render Pictures after the application had already destroyed the Drawable they reference. (It would be nice if the X server wouldn't complain that some cleanup work is already done, but there you have it.) This fix has been verified to fix the bug causing OpenOffice.org to crash as described here: XError on right click menus in OOo. https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=243811 And unlike other proposed fixes for this bug, this fix does not introduce any new calls to XSync, (and thereby avoids performance concerns from those).
Diffstat (limited to 'src')
-rw-r--r--src/cairo-xlib-surface.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index db5c1554..f7750051 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -273,30 +273,29 @@ _cairo_xlib_surface_finish (void *abstract_surface)
NULL;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
- if (surface->dst_picture != None) {
+ if (surface->owns_pixmap) {
cairo_status_t status2;
- status2 = _cairo_xlib_display_queue_resource (display,
- XRenderFreePicture,
- surface->dst_picture);
- if (status2 == CAIRO_STATUS_SUCCESS)
- surface->dst_picture = None;
- else if (status == CAIRO_STATUS_SUCCESS)
- status = status2;
- }
- if (surface->src_picture != None) {
- cairo_status_t status2;
- status2 = _cairo_xlib_display_queue_resource (display,
- XRenderFreePicture,
- surface->src_picture);
- if (status2 == CAIRO_STATUS_SUCCESS)
- surface->src_picture = None;
- else if (status == CAIRO_STATUS_SUCCESS)
- status = status2;
- }
+ if (surface->dst_picture != None) {
+ status2 = _cairo_xlib_display_queue_resource (display,
+ XRenderFreePicture,
+ surface->dst_picture);
+ if (status2 == CAIRO_STATUS_SUCCESS)
+ surface->dst_picture = None;
+ else if (status == CAIRO_STATUS_SUCCESS)
+ status = status2;
+ }
+
+ if (surface->src_picture != None) {
+ status2 = _cairo_xlib_display_queue_resource (display,
+ XRenderFreePicture,
+ surface->src_picture);
+ if (status2 == CAIRO_STATUS_SUCCESS)
+ surface->src_picture = None;
+ else if (status == CAIRO_STATUS_SUCCESS)
+ status = status2;
+ }
- if (surface->owns_pixmap) {
- cairo_status_t status2;
status2 = _cairo_xlib_display_queue_resource (display,
(cairo_xlib_notify_resource_func) XFreePixmap,
surface->drawable);
@@ -305,6 +304,12 @@ _cairo_xlib_surface_finish (void *abstract_surface)
surface->drawable = None;
} else if (status == CAIRO_STATUS_SUCCESS)
status = status2;
+ } else {
+ if (surface->dst_picture != None)
+ XRenderFreePicture (surface->dpy, surface->dst_picture);
+
+ if (surface->src_picture != None)
+ XRenderFreePicture (surface->dpy, surface->src_picture);
}
if (surface->gc != NULL) {