[gtk+] Don't access region when it might be freed



commit 753f159aad956de1455f5d7c0b2cd8b79a7fb7f5
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Sep 4 13:10:35 2009 +0200

    Don't access region when it might be freed
    
    Passing region into _gdk_gc_set_clip_region_internal takes ownership,
    so don't use it after that. We can just as well just move the usage
    above the call.

 gdk/gdkwindow.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index a673be7..3f27f9a 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2528,6 +2528,9 @@ gdk_window_flush_implicit_paint (GdkWindow *window)
 
   if (!gdk_region_empty (region))
     {
+      /* Remove flushed region from the implicit paint */
+      gdk_region_subtract (paint->region, region);
+
       /* Some regions are valid, push these to window now */
       tmp_gc = _gdk_drawable_get_scratch_gc ((GdkDrawable *)window, FALSE);
       _gdk_gc_set_clip_region_internal (tmp_gc, region, TRUE);
@@ -2535,9 +2538,6 @@ gdk_window_flush_implicit_paint (GdkWindow *window)
 			 0, 0, paint->x_offset, paint->y_offset, -1, -1);
       /* Reset clip region of the cached GdkGC */
       gdk_gc_set_clip_region (tmp_gc, NULL);
-
-      /* Remove flushed region from the implicit paint */
-      gdk_region_subtract (paint->region, region);
     }
   else
     gdk_region_destroy (region);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]