[mutter] wayland: Clean up tablet manager state
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Clean up tablet manager state
- Date: Mon, 25 Jul 2022 15:13:58 +0000 (UTC)
commit d928b6baa60fafd1e10e7d17d6227af718d101fb
Author: Michel Dänzer <mdaenzer redhat com>
Date: Sat Jul 23 17:13:21 2022 +0200
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: 745cb6798833 ("wayland: Initialize the MetaWaylandTabletManager")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
src/wayland/meta-wayland-tablet-manager.c | 6 +++---
src/wayland/meta-wayland-tablet-manager.h | 2 +-
src/wayland/meta-wayland.c | 1 +
3 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-tablet-manager.c b/src/wayland/meta-wayland-tablet-manager.c
index 7ee1c9fe7b..c8aae5d745 100644
--- a/src/wayland/meta-wayland-tablet-manager.c
+++ b/src/wayland/meta-wayland-tablet-manager.c
@@ -127,10 +127,10 @@ meta_wayland_tablet_manager_init (MetaWaylandCompositor *compositor)
}
void
-meta_wayland_tablet_manager_free (MetaWaylandTabletManager *tablet_manager)
+meta_wayland_tablet_manager_finalize (MetaWaylandCompositor *compositor)
{
- g_hash_table_destroy (tablet_manager->seats);
- g_free (tablet_manager);
+ g_hash_table_destroy (compositor->tablet_manager->seats);
+ g_clear_pointer (&compositor->tablet_manager, g_free);
}
static MetaWaylandTabletSeat *
diff --git a/src/wayland/meta-wayland-tablet-manager.h b/src/wayland/meta-wayland-tablet-manager.h
index 83f9d3d0f4..6491fbcbc8 100644
--- a/src/wayland/meta-wayland-tablet-manager.h
+++ b/src/wayland/meta-wayland-tablet-manager.h
@@ -37,7 +37,7 @@ struct _MetaWaylandTabletManager
};
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,
const ClutterEvent *event);
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index f8b23fec8d..4cc2248d30 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -451,6 +451,7 @@ meta_wayland_compositor_finalize (GObject *object)
meta_wayland_activation_finalize (compositor);
meta_wayland_outputs_finalize (compositor);
meta_wayland_presentation_time_finalize (compositor);
+ meta_wayland_tablet_manager_finalize (compositor);
g_hash_table_destroy (compositor->scheduled_surface_associations);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]