[gnome-control-center] network: avoid crashes due to leftover signal handlers



commit dcb34090cc5b258dcec19f88306d2119e4c57c29
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 27 23:02:02 2012 -0400

    network: avoid crashes due to leftover signal handlers
    
    The libnm objects can survive the disposal of the network panel.
    If we don't disconnect the signal handlers on them, bad things
    can happen. Use g_signal_connect_object to tie the life-cycle
    of the signal handlers to the panel.
    https://bugzilla.gnome.org/show_bug.cgi?id=677969
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 panels/network/cc-network-panel.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index b1b4035..43858c5 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -652,14 +652,10 @@ object_removed_cb (NetObject *object, CcNetworkPanel *panel)
 static void
 register_object_interest (CcNetworkPanel *panel, NetObject *object)
 {
-        g_signal_connect (object,
-                          "changed",
-                          G_CALLBACK (object_changed_cb),
-                          panel);
-        g_signal_connect (object,
-                          "removed",
-                          G_CALLBACK (object_removed_cb),
-                          panel);
+        g_signal_connect_object (object, "changed",
+                                 G_CALLBACK (object_changed_cb), panel, 0);
+        g_signal_connect_object (object, "removed",
+                                 G_CALLBACK (object_removed_cb), panel, 0);
 }
 
 static void
@@ -734,8 +730,8 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
         g_debug ("device %s type %i",
                  nm_device_get_udi (device),
                  nm_device_get_device_type (device));
-        g_signal_connect (G_OBJECT (device), "notify::state",
-                          (GCallback) device_state_notify_changed_cb, panel);
+        g_signal_connect_object (G_OBJECT (device), "notify::state",
+                                 (GCallback) device_state_notify_changed_cb, panel, 0);
 
         /* do we have to get additonal data from ModemManager */
         if (type == NM_DEVICE_TYPE_MODEM) {



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