diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2019-08-02 20:43:50 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2019-08-12 13:45:35 +0300 |
commit | 0ceae2509eb6b04310533801ae599338939add89 (patch) | |
tree | 5e39481d3de44209c01352ad60178915d23a7001 /libwnck | |
parent | d3a714db6af5c1a146effb8d8f827b8973bbb91c (diff) | |
download | libwnck-0ceae2509eb6b04310533801ae599338939add89.tar.gz |
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
Diffstat (limited to 'libwnck')
-rw-r--r-- | libwnck/class-group.c | 16 |
1 files changed, 16 insertions, 0 deletions
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); |