[gtk+] wayland: Plug surface leak



commit d62febcf97581528398f79e8094eb26f8461b315
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 24 17:41:58 2015 +0100

    wayland: Plug surface leak
    
    Other backends take care of the cairo surface destruction in
    GdkWindow::destroy. We must do the same here, or the cairo_surface
    and its corresponding wl_buffer are left dangling.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747295

 gdk/wayland/gdkdisplay-wayland.c |    4 ++++
 gdk/wayland/gdkwindow-wayland.c  |    6 +++++-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 64529fb..804c167 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -1029,6 +1029,8 @@ gdk_wayland_cairo_surface_destroy (void *p)
 {
   GdkWaylandCairoSurfaceData *data = p;
 
+  g_print ("EHMMMM...\n");
+
   if (data->buffer)
     wl_buffer_destroy (data->buffer);
 
@@ -1056,6 +1058,8 @@ _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
   data->scale = scale;
   data->busy = FALSE;
 
+  g_print ("create shm surface...\n");
+
   stride = width * 4;
 
   data->pool = create_shm_pool (display->shm,
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 0834235..a536e1f 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1769,7 +1769,11 @@ gdk_wayland_window_destroy (GdkWindow *window,
   gdk_wayland_window_hide_surface (window);
 
   if (impl->cairo_surface)
-    cairo_surface_finish (impl->cairo_surface);
+    {
+      cairo_surface_finish (impl->cairo_surface);
+      cairo_surface_destroy (impl->cairo_surface);
+      impl->cairo_surface = NULL;
+    }
 }
 
 static void


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