From 8067065687111670126f8ed708d3e7efd067b71b Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sat, 4 Mar 2023 16:07:02 +0100 Subject: [PATCH] tray: Ensure tray children are disposed when unmanaging tray These might survive, trigger signals and crashes. Dispose the tray children and disconnect any remaining signals in order to avoid that. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6465 Part-of: --- src/tray/na-tray-manager.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/tray/na-tray-manager.c b/src/tray/na-tray-manager.c index 1fbb7ac20..a500bcfaf 100644 --- a/src/tray/na-tray-manager.c +++ b/src/tray/na-tray-manager.c @@ -490,6 +490,8 @@ static void na_tray_manager_unmanage (NaTrayManager *manager) { Display *xdisplay; + NaTrayChild *child; + GHashTableIter iter; if (manager->window == None) return; @@ -510,6 +512,17 @@ na_tray_manager_unmanage (NaTrayManager *manager) XDestroyWindow (xdisplay, manager->window); manager->window = None; + + g_hash_table_iter_init (&iter, manager->children); + + while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &child)) + { + g_signal_handlers_disconnect_by_func (child, + na_tray_manager_plug_removed, + manager); + g_hash_table_iter_remove (&iter); + g_object_unref (child); + } } static void