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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2588>
This commit is contained in:
Carlos Garnacho 2022-08-19 17:13:01 +02:00 committed by Marge Bot
parent f4f39d3a2c
commit 9c402bd091

View File

@ -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);
}