diff options
author | Matthias Clasen <mclasen@redhat.com> | 2012-06-27 23:02:02 -0400 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2012-06-28 13:46:03 +0100 |
commit | dcb34090cc5b258dcec19f88306d2119e4c57c29 (patch) | |
tree | 9a787708fe753c9a29613ceca83bd4275ed30791 | |
parent | 6689012eb8881c548fbca52c2ac09c7511e7deae (diff) | |
download | gnome-control-center-dcb34090cc5b258dcec19f88306d2119e4c57c29.tar.gz |
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>
-rw-r--r-- | 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 b1b403568..43858c5b8 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) { |