[gnome-control-center/iainl/privacy-panel-disconnect-settings-signal-properly: 1/2] privacy: Disconnect from GSettings::changed when label is destroyed



commit 9b497ea627df1e70736082687aff53bb290febed
Author: Iain Lane <iainl gnome org>
Date:   Tue Feb 19 08:51:06 2019 +0000

    privacy: Disconnect from GSettings::changed when label is destroyed
    
    The cb calls gtk_label_set_text(), so we should be sure to not call it
    after the label is destroyed.

 panels/privacy/cc-privacy-panel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
index 91f54570a..f2ccdc0b0 100644
--- a/panels/privacy/cc-privacy-panel.c
+++ b/panels/privacy/cc-privacy-panel.c
@@ -291,8 +291,11 @@ get_on_off_label2 (GSettings *settings,
   data->key1 = g_strdup (key1);
   data->key2 = g_strdup (key2);
 
-  g_signal_connect (settings, "changed",
-                    G_CALLBACK (set_on_off_label2), data);
+  g_signal_connect_object (settings,
+                           "changed",
+                           G_CALLBACK (set_on_off_label2),
+                           data->label,
+                           0);
 
   set_on_off_label2 (settings, key1, data);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]