From 9c402bd091255e8a21f7e3263559dbe63135dec7 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 19 Aug 2022 17:13:01 +0200 Subject: [PATCH] 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. Part-of: --- src/wayland/meta-wayland-buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c index 557952b6f..7a22f824b 100644 --- a/src/wayland/meta-wayland-buffer.c +++ b/src/wayland/meta-wayland-buffer.c @@ -83,12 +83,13 @@ G_DEFINE_TYPE (MetaWaylandBuffer, meta_wayland_buffer, G_TYPE_OBJECT); static void meta_wayland_buffer_destroy_handler (struct wl_listener *listener, - void *data) + void *data) { MetaWaylandBuffer *buffer = 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); }