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

Chris Wilson ickle at kemper.freedesktop.org
Thu Sep 13 14:55:33 PDT 2012


 src/cairo-xlib-surface.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 5c59d989f9037f94c80ccd7929dc05f4a95be4df
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Sep 13 22:50:11 2012 +0100

    xlib: Destroy the fallback damage along with the fallback surface
    
    Whenever we discard the fallback surface, we need to destroy the
    associated damage tracking, so move this into the common discard
    routine.
    
    This should fix the issue when trying to flush the fallback before
    the user modifies any foreign Drawables. The current code issued the
    flush and then explicitly discard the fallback, but unless it was idle
    at the time of the flush the associated damage would not have also been
    destroyed. Asserts followed.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=54657
    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 58576b8..718f4e7 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -370,8 +370,10 @@ _cairo_xlib_surface_discard_shm (cairo_xlib_surface_t *surface)
 
     cairo_surface_finish (surface->shm);
     cairo_surface_destroy (surface->shm);
-
     surface->shm = NULL;
+
+    _cairo_damage_destroy (surface->base.damage);
+    surface->base.damage = NULL;
 }
 
 static cairo_status_t
@@ -1447,13 +1449,8 @@ _cairo_xlib_surface_flush (void *abstract_surface,
 	return status;
 
     surface->fallback >>= 1;
-    if (surface->shm && _cairo_xlib_shm_surface_is_idle (surface->shm)) {
-	cairo_surface_destroy (surface->shm);
-	surface->shm = NULL;
-
-	_cairo_damage_destroy (surface->base.damage);
-	surface->base.damage = NULL;
-    }
+    if (surface->shm && _cairo_xlib_shm_surface_is_idle (surface->shm))
+	_cairo_xlib_surface_discard_shm (surface);
 
     return CAIRO_STATUS_SUCCESS;
 }


More information about the cairo-commit mailing list