From 15a98c3fd899bcf039ad1b716b45610b72018c1e Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 2 Sep 2014 19:08:46 +0200 Subject: [PATCH] network: Show an error when we fail to turn off hotspot And reset the switch as well. I don't know in which circumstance it could happen, but it's all we can do for now. https://bugzilla.gnome.org/show_bug.cgi?id=723643 --- panels/network/net-device-wifi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c index c11a6343b..78bac7f28 100644 --- a/panels/network/net-device-wifi.c +++ b/panels/network/net-device-wifi.c @@ -1180,6 +1180,7 @@ stop_shared_connection (NetDeviceWifi *device_wifi) gint i; NMActiveConnection *c; NMClient *client; + gboolean found = FALSE; device = net_device_get_nm_device (NET_DEVICE (device_wifi)); client = net_object_get_client (NET_OBJECT (device_wifi)); @@ -1190,10 +1191,19 @@ stop_shared_connection (NetDeviceWifi *device_wifi) devices = nm_active_connection_get_devices (c); if (devices && devices->pdata[0] == device) { nm_client_deactivate_connection (client, c); + found = TRUE; break; } } + if (!found) { + g_warning ("Could not stop hotspot connection as no connection attached to the device could be found."); + device_wifi->priv->updating_device = TRUE; + gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE); + device_wifi->priv->updating_device = FALSE; + return; + } + nm_device_wifi_refresh_ui (device_wifi); show_wifi_list (device_wifi); }