[libwnck/wip/muktupavels/issue-141] class-group: add a weak reference callback to window
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libwnck/wip/muktupavels/issue-141] class-group: add a weak reference callback to window
- Date: Fri, 2 Aug 2019 17:59:35 +0000 (UTC)
commit ad6bb8e71e5cbee14ad249450cc56b75a24f2d69
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Aug 2 20:43:50 2019 +0300
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..e90a466 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_object_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_object_was);
+ g_hash_table_remove (priv->window_name_handlers, where_the_object_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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]