[gnome-control-center] network/net-device-ethernet: Disconnect from NMConnection signals



commit d8bfc9e937db40139e76e9b43c5f57128b01842f
Author: Rui Matos <tiagomatos gmail com>
Date:   Fri Sep 20 17:23:06 2013 +0200

    network/net-device-ethernet: Disconnect from NMConnection signals
    
    Otherwise we'll crash in our handler if the signal fires after we're
    finalized i.e. user leaves the network panel.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708468

 panels/network/net-device-ethernet.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index 9f5c4e6..f92fad9 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -605,9 +605,20 @@ static void
 device_ethernet_finalize (GObject *object)
 {
         NetDeviceEthernet *device = NET_DEVICE_ETHERNET (object);
+        GSList *connections, *l;
 
         g_object_unref (device->builder);
 
+        connections = net_device_get_valid_connections (NET_DEVICE (device));
+        for (l = connections; l; l = l->next) {
+                NMConnection *connection = l->data;
+                if (g_object_get_data (G_OBJECT (connection), "removed_signal_handler")) {
+                        g_signal_handlers_disconnect_by_func (connection, connection_removed, device);
+                        g_object_set_data (G_OBJECT (connection), "removed_signal_handler", NULL);
+                }
+        }
+        g_slist_free (connections);
+
         G_OBJECT_CLASS (net_device_ethernet_parent_class)->finalize (object);
 }
 


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