From 0ceae2509eb6b04310533801ae599338939add89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= Date: Fri, 2 Aug 2019 20:43:50 +0300 Subject: class-group: add a weak reference callback to window When wnck_shutdown is called all windows are destroyed, but nothing removes signal handlers from hash tables. When class group is destroyed it will try to remove signal handlers from already destroyed windows. Use weak reference callback to remove obsolete signal handlers from hash tables. https://gitlab.gnome.org/GNOME/libwnck/issues/141 --- libwnck/class-group.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libwnck/class-group.c b/libwnck/class-group.c index 2a274e2..4b658d8 100644 --- a/libwnck/class-group.c +++ b/libwnck/class-group.c @@ -496,6 +496,20 @@ update_class_group_name (WnckWindow *window, set_name (class_group); } +static void +window_weak_notify_cb (gpointer data, + GObject *where_the_window_was) +{ + WnckClassGroup *class_group; + WnckClassGroupPrivate *priv; + + class_group = WNCK_CLASS_GROUP (data); + priv = class_group->priv; + + g_hash_table_remove (priv->window_icon_handlers, where_the_window_was); + g_hash_table_remove (priv->window_name_handlers, where_the_window_was); +} + /** * _wnck_class_group_add_window: * @class_group: a #WnckClassGroup. @@ -534,6 +548,8 @@ _wnck_class_group_add_window (WnckClassGroup *class_group, window, (gpointer) signal_id); + g_object_weak_ref (G_OBJECT (window), window_weak_notify_cb, class_group); + set_name (class_group); set_icon (class_group); -- cgit v1.2.1