summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2018-06-28 16:08:38 +1200
committerRobert Ancell <robert.ancell@canonical.com>2018-07-03 11:42:00 +1200
commitb3ea72735a6dc69b3cf569bb0d14280965db561d (patch)
tree5540857303cdebb771c7628e1883e9811dd7c579
parent556388f373c0f1be860d371db91d88f0baac245d (diff)
downloadgnome-control-center-b3ea72735a6dc69b3cf569bb0d14280965db561d.tar.gz
notifications: Use g_signal_connect_object to ensure handlers are not run after object destroyed
Fixes specific crash: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/75
-rw-r--r--panels/notifications/cc-notifications-panel.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/panels/notifications/cc-notifications-panel.c b/panels/notifications/cc-notifications-panel.c
index e135c61c7..dc04e7757 100644
--- a/panels/notifications/cc-notifications-panel.c
+++ b/panels/notifications/cc-notifications-panel.c
@@ -203,7 +203,7 @@ cc_notifications_panel_init (CcNotificationsPanel *panel)
"ccnotify-switch-listbox"));
panel->sections = g_list_append (panel->sections, w);
panel->sections_reverse = g_list_prepend (panel->sections_reverse, w);
- g_signal_connect (w, "keynav-failed", G_CALLBACK (keynav_failed), panel);
+ g_signal_connect_object (w, "keynav-failed", G_CALLBACK (keynav_failed), panel, 0);
gtk_list_box_set_header_func (GTK_LIST_BOX (w),
cc_list_box_update_header_func,
NULL, NULL);
@@ -221,14 +221,14 @@ cc_notifications_panel_init (CcNotificationsPanel *panel)
panel->sections = g_list_append (panel->sections, w);
panel->sections_reverse = g_list_prepend (panel->sections_reverse, w);
- g_signal_connect (w, "keynav-failed", G_CALLBACK (keynav_failed), panel);
+ g_signal_connect_object (w, "keynav-failed", G_CALLBACK (keynav_failed), panel, 0);
gtk_list_box_set_sort_func (GTK_LIST_BOX (w), (GtkListBoxSortFunc)sort_apps, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (w),
cc_list_box_update_header_func,
NULL, NULL);
- g_signal_connect (GTK_LIST_BOX (w), "row-activated",
- G_CALLBACK (select_app), panel);
+ g_signal_connect_object (GTK_LIST_BOX (w), "row-activated",
+ G_CALLBACK (select_app), panel, 0);
build_app_store (panel);
@@ -543,8 +543,9 @@ build_app_store (CcNotificationsPanel *panel)
{
/* Build application entries for known applications */
children_changed (panel->master_settings, NULL, panel);
- g_signal_connect (panel->master_settings, "changed::application-children",
- G_CALLBACK (children_changed), panel);
+ g_signal_connect_object (panel->master_settings,
+ "changed::application-children",
+ G_CALLBACK (children_changed), panel, 0);
/* Scan applications that statically declare to show notifications */
load_apps_async (panel);