[mutter] wayland: Clean up output state
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Clean up output state
- Date: Mon, 25 Jul 2022 15:13:58 +0000 (UTC)
commit f3cd2b8ce7ce0fcc7a9131b1ddd3e4efd3ea83e4
Author: Michel Dänzer <mdaenzer redhat com>
Date: Sat Jul 23 17:06:59 2022 +0200
wayland: Clean up output state
Fixes memory leak:
==995170== 383 (96 direct, 287 indirect) bytes in 1 blocks are definitely lost in loss record 14,733 of
15,641
==995170== at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==995170== by 0x4B21178: g_malloc (gmem.c:125)
==995170== by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==995170== by 0x4B0766D: g_hash_table_new_full (ghash.c:1071)
==995170== by 0x4A4A8B4: meta_wayland_compositor_update_outputs (meta-wayland-outputs.c:483)
==995170== by 0x4A4ABAB: meta_wayland_outputs_init (meta-wayland-outputs.c:716)
==995170== by 0x4A3FA65: meta_wayland_compositor_new (meta-wayland.c:620)
==995170== by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170== by 0x10F065: main (mutter.c:148)
v2:
* Use meta_backend_get_monitor_manager. (Jonas Ådahl)
Fixes: 9a4783e3644c ("Integrate the monitor manager with wayland")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
src/wayland/meta-wayland-outputs.c | 13 +++++++++++++
src/wayland/meta-wayland-outputs.h | 2 ++
src/wayland/meta-wayland.c | 1 +
3 files changed, 16 insertions(+)
---
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index 6c8baa0dfc..c2544ff121 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -704,6 +704,19 @@ bind_xdg_output_manager (struct wl_client *client,
NULL, NULL);
}
+void
+meta_wayland_outputs_finalize (MetaWaylandCompositor *compositor)
+{
+ MetaBackend *backend = meta_context_get_backend (compositor->context);
+ MetaMonitorManager *monitor_manager =
+ meta_backend_get_monitor_manager (backend);
+
+ g_signal_handlers_disconnect_by_func (monitor_manager, on_monitors_changed,
+ compositor);
+
+ g_hash_table_destroy (compositor->outputs);
+}
+
void
meta_wayland_outputs_init (MetaWaylandCompositor *compositor)
{
diff --git a/src/wayland/meta-wayland-outputs.h b/src/wayland/meta-wayland-outputs.h
index 87b980f697..af3a509ce2 100644
--- a/src/wayland/meta-wayland-outputs.h
+++ b/src/wayland/meta-wayland-outputs.h
@@ -36,6 +36,8 @@ const GList * meta_wayland_output_get_resources (MetaWaylandOutput *wayland_outp
MetaLogicalMonitor * meta_wayland_output_get_logical_monitor (MetaWaylandOutput *wayland_output);
+void meta_wayland_outputs_finalize (MetaWaylandCompositor *compositor);
+
void meta_wayland_outputs_init (MetaWaylandCompositor *compositor);
#endif /* META_WAYLAND_OUTPUTS_H */
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index fb800f589f..f8b23fec8d 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -449,6 +449,7 @@ meta_wayland_compositor_finalize (GObject *object)
ClutterActor *stage = meta_backend_get_stage (backend);
meta_wayland_activation_finalize (compositor);
+ meta_wayland_outputs_finalize (compositor);
meta_wayland_presentation_time_finalize (compositor);
g_hash_table_destroy (compositor->scheduled_surface_associations);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]