[gtk+/rendering-cleanup-next: 130/199] gdk: Make GdkWindow cope better with its surface outliving the window



commit c6416854d38ee15521855fb692bb892db49d6eff
Author: Benjamin Otte <otte redhat com>
Date:   Thu Sep 9 02:13:33 2010 +0200

    gdk: Make GdkWindow cope better with its surface outliving the window
    
    Make extra sure we release the surface properly. Also make sure that the
    released surface doesn't keep any references to us.

 gdk/gdkwindow.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 40252be..524a5d9 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -523,6 +523,8 @@ gdk_window_finalize (GObject *object)
 	_gdk_window_destroy (window, TRUE);
     }
 
+  gdk_window_drop_cairo_surface (obj);
+
   if (obj->impl)
     {
       g_object_unref (obj->impl);
@@ -1027,8 +1029,7 @@ recompute_visible_regions_internal (GdkWindowObject *private,
                                                private->width,
                                                private->height)))
     {
-      cairo_surface_destroy (private->cairo_surface);
-      private->cairo_surface = NULL;
+      gdk_window_drop_cairo_surface (private);
     }
 }
 
@@ -3664,6 +3665,7 @@ gdk_window_drop_cairo_surface (GdkWindowObject *private)
       cairo_surface_finish (private->cairo_surface);
       cairo_surface_set_user_data (private->cairo_surface, &gdk_window_cairo_key,
 				   NULL, NULL);
+      private->cairo_surface = NULL;
     }
 }
 



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