wayland: Clean up xdg-activation state

Fixes memory leak:

==995170== 240 (48 direct, 192 indirect) bytes in 1 blocks are definitely lost in loss record 14,428 of 15,641
==995170==    at 0x48445EF: calloc (vg_replace_malloc.c:1328)
==995170==    by 0x4B211D0: g_malloc0 (gmem.c:155)
==995170==    by 0x4A3CDB3: meta_wayland_activation_init (meta-wayland-activation.c:383)
==995170==    by 0x4A3FB0C: meta_wayland_compositor_new (meta-wayland.c:636)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: ec390b68c5 ("wayland: Implement the xdg-activation protocol")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
This commit is contained in:
Michel Dänzer 2022-07-23 16:52:52 +02:00 committed by Marge Bot
parent 4ddefb9a69
commit b329dce070
3 changed files with 11 additions and 0 deletions

View File

@ -375,6 +375,13 @@ bind_activation (struct wl_client *client,
wl_resource_get_link (resource));
}
void
meta_wayland_activation_finalize (MetaWaylandCompositor *compositor)
{
g_hash_table_destroy (compositor->activation->tokens);
g_clear_pointer (&compositor->activation, g_free);
}
void
meta_wayland_activation_init (MetaWaylandCompositor *compositor)
{

View File

@ -27,6 +27,8 @@
#include "wayland/meta-wayland-types.h"
void meta_wayland_activation_finalize (MetaWaylandCompositor *compositor);
void meta_wayland_activation_init (MetaWaylandCompositor *compositor);
#endif /* META_WAYLAND_ACTIVATION_H */

View File

@ -448,6 +448,8 @@ meta_wayland_compositor_finalize (GObject *object)
MetaBackend *backend = meta_context_get_backend (compositor->context);
ClutterActor *stage = meta_backend_get_stage (backend);
meta_wayland_activation_finalize (compositor);
g_hash_table_destroy (compositor->scheduled_surface_associations);
g_signal_handlers_disconnect_by_func (stage, on_after_update, compositor);