[cairo-commit] src/cairo-xlib-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Sep 8 08:41:55 PDT 2012


 src/cairo-xlib-surface.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit f864e2d70f53a1feeee5e32bf9724b1e544025a6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Sep 8 16:39:05 2012 +0100

    xlib/shm: Explicitly release shm surface if we do not own the pixmap
    
    In this case we want to prevent the short-circuiting of the flush of the
    ShmPixmap that is ordinarily performed during finish().
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index a35ea43..ab21912 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -377,11 +377,18 @@ _cairo_xlib_surface_finish (void *abstract_surface)
 	XRenderFreePicture (display->display, surface->embedded_source.picture);
     if (surface->picture)
 	XRenderFreePicture (display->display, surface->picture);
+
+    if (surface->shm) {
+	/* Force the flush for an external surface */
+	if (!surface->owns_pixmap)
+	    cairo_surface_flush (surface->shm);
+	cairo_surface_finish (surface->shm);
+	cairo_surface_destroy (surface->shm);
+    }
+
     if (surface->owns_pixmap)
 	XFreePixmap (display->display, surface->drawable);
 
-    cairo_surface_destroy (surface->shm);
-
     cairo_device_release (&display->base);
 
     return status;


More information about the cairo-commit mailing list