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
This commit is contained in:
Rui Matos 2013-09-20 17:23:06 +02:00 committed by Bastien Nocera
parent 8dc9336f52
commit d8bfc9e937

View file

@ -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);
}