[gtk/wayland-cursor-texture-leak] wayland: Avoid leaking cursor textures




commit 0bd15b44f2e1e9fe72874340d165914a9fe96855
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 13 13:19:49 2022 -0400

    wayland: Avoid leaking cursor textures
    
    When we fall back to the default cursor and load it
    from a resource, we need to free the texture.

 gdk/wayland/gdkcursor-wayland.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c
index a5602bcbaf..41cd2e4fc4 100644
--- a/gdk/wayland/gdkcursor-wayland.c
+++ b/gdk/wayland/gdkcursor-wayland.c
@@ -215,7 +215,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
       cairo_surface_t *surface;
       struct wl_buffer *buffer;
 
-      texture = gdk_cursor_get_texture (cursor);
+      texture = g_object_ref (gdk_cursor_get_texture (cursor));
 
 from_texture:
       surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
@@ -245,6 +245,8 @@ from_texture:
       buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
       wl_buffer_add_listener (buffer, &buffer_listener, surface);
 
+      g_object_unref (texture);
+
       return buffer;
     }
 


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