wayland: Clean up tablet manager state

Fixes memory leak:

==995170== 936 (40 direct, 896 indirect) bytes in 1 blocks are definitely lost in loss record 15,090 of 15,641
==995170==    at 0x48445EF: calloc (vg_replace_malloc.c:1328)
==995170==    by 0x4B211D0: g_malloc0 (gmem.c:155)
==995170==    by 0x4A56693: meta_wayland_tablet_manager_new (meta-wayland-tablet-manager.c:109)
==995170==    by 0x4A56693: meta_wayland_tablet_manager_init (meta-wayland-tablet-manager.c:126)
==995170==    by 0x4A3FA95: meta_wayland_compositor_new (meta-wayland.c:626)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: 745cb67988 ("wayland: Initialize the MetaWaylandTabletManager")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
This commit is contained in:
Michel Dänzer 2022-07-23 17:13:21 +02:00 committed by Marge Bot
parent f3cd2b8ce7
commit d928b6baa6
3 changed files with 5 additions and 4 deletions

View File

@ -127,10 +127,10 @@ meta_wayland_tablet_manager_init (MetaWaylandCompositor *compositor)
} }
void void
meta_wayland_tablet_manager_free (MetaWaylandTabletManager *tablet_manager) meta_wayland_tablet_manager_finalize (MetaWaylandCompositor *compositor)
{ {
g_hash_table_destroy (tablet_manager->seats); g_hash_table_destroy (compositor->tablet_manager->seats);
g_free (tablet_manager); g_clear_pointer (&compositor->tablet_manager, g_free);
} }
static MetaWaylandTabletSeat * static MetaWaylandTabletSeat *

View File

@ -37,7 +37,7 @@ struct _MetaWaylandTabletManager
}; };
void meta_wayland_tablet_manager_init (MetaWaylandCompositor *compositor); void meta_wayland_tablet_manager_init (MetaWaylandCompositor *compositor);
void meta_wayland_tablet_manager_free (MetaWaylandTabletManager *tablet_manager); void meta_wayland_tablet_manager_finalize (MetaWaylandCompositor *compositor);
gboolean meta_wayland_tablet_manager_consumes_event (MetaWaylandTabletManager *manager, gboolean meta_wayland_tablet_manager_consumes_event (MetaWaylandTabletManager *manager,
const ClutterEvent *event); const ClutterEvent *event);

View File

@ -451,6 +451,7 @@ meta_wayland_compositor_finalize (GObject *object)
meta_wayland_activation_finalize (compositor); meta_wayland_activation_finalize (compositor);
meta_wayland_outputs_finalize (compositor); meta_wayland_outputs_finalize (compositor);
meta_wayland_presentation_time_finalize (compositor); meta_wayland_presentation_time_finalize (compositor);
meta_wayland_tablet_manager_finalize (compositor);
g_hash_table_destroy (compositor->scheduled_surface_associations); g_hash_table_destroy (compositor->scheduled_surface_associations);