[mutter/wip/carlosg/unlink-listeners: 3/3] wayland: Ensure to remove destroy listener for MetaWaylandBuffer




commit 1204a517661c9e9d7912caaecb5f2db9a43d83ed
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Aug 19 17:13:01 2022 +0200

    wayland: Ensure to remove destroy listener for MetaWaylandBuffer
    
    Avoid the chance of invalid memory access by leaving the wl_listener
    behind when handling the destroy notification.

 src/wayland/meta-wayland-buffer.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
index 557952b6fe..54937c01aa 100644
--- a/src/wayland/meta-wayland-buffer.c
+++ b/src/wayland/meta-wayland-buffer.c
@@ -89,6 +89,7 @@ meta_wayland_buffer_destroy_handler (struct wl_listener *listener,
     wl_container_of (listener, buffer, destroy_listener);
 
   buffer->resource = NULL;
+  wl_list_remove (&buffer->destroy_listener.link);
   g_signal_emit (buffer, signals[RESOURCE_DESTROYED], 0);
   g_object_unref (buffer);
 }


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