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



commit 386a7060d432dcb7a628d8ab05fe9a4503e15f87
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 c1a8cd2..ff18e2b 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);
     }
 }
 
@@ -3661,6 +3662,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]