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



commit 33393772f8c3cf9d8bc369ab7bd06fd6669c71b8
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 092b0d5..8a9e35c 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -580,9 +580,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]