]> Pileus Git - ~andy/gtk/commitdiff
Don't access region when it might be freed
authorAlexander Larsson <alexl@redhat.com>
Fri, 4 Sep 2009 11:10:35 +0000 (13:10 +0200)
committerAlexander Larsson <alexl@redhat.com>
Fri, 4 Sep 2009 11:10:35 +0000 (13:10 +0200)
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

index a673be78e4bc550893f65256535e4443554a3dd8..3f27f9a702890035c9e696f3b644f7da99f1cb78 100644 (file)
@@ -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);