From fc8be961634a2bf5bd44f1648859f93df62c4f86 Mon Sep 17 00:00:00 2001 From: Olivier Brunel Date: Tue, 5 Nov 2013 19:21:28 +0100 Subject: [PATCH] gtkpixelcache: Fix possibly ignoring queued redraw If a queue_redraw() (invalidating a region, or the whole widget) was called from the draw() call, it could get ignored if surface_dirty existed, as it would then be updated, but destroyed right at the end of the _gtk_pixel_cache_repaint(), leading the next call to _gtk_pixel_cache_draw() have its call to repaint() be a no-op (since there's no surface_dirty) and then simply draw from (non updated) surface. Signed-off-by: Olivier Brunel https://bugzilla.gnome.org/show_bug.cgi?id=711545 --- gtk/gtkpixelcache.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c index 2c03330557..411a75e7c3 100644 --- a/gtk/gtkpixelcache.c +++ b/gtk/gtkpixelcache.c @@ -327,13 +327,15 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache, gpointer user_data) { cairo_t *backing_cr; + cairo_region_t *region_dirty = cache->surface_dirty; + cache->surface_dirty = NULL; if (cache->surface && - cache->surface_dirty && - !cairo_region_is_empty (cache->surface_dirty)) + region_dirty && + !cairo_region_is_empty (region_dirty)) { backing_cr = cairo_create (cache->surface); - gdk_cairo_region (backing_cr, cache->surface_dirty); + gdk_cairo_region (backing_cr, region_dirty); cairo_clip (backing_cr); cairo_translate (backing_cr, -cache->surface_x - canvas_rect->x - view_rect->x, @@ -370,11 +372,8 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache, cairo_destroy (backing_cr); } - if (cache->surface_dirty) - { - cairo_region_destroy (cache->surface_dirty); - cache->surface_dirty = NULL; - } + if (region_dirty) + cairo_region_destroy (region_dirty); } static gboolean