From 5c59d989f9037f94c80ccd7929dc05f4a95be4df Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 13 Sep 2012 22:50:11 +0100 Subject: 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 --- src/cairo-xlib-surface.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 58576b822..718f4e731 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; } -- cgit v1.2.3