With a WiFi to WiFi switch, the previous network is being disconnected
while the new one is waiting for the device to become available.
Protect the network struct with a ref so it will be available while
the previous network is disconnecting.
---
plugins/wifi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 58d8bb2..4500839 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1500,8 +1500,10 @@ static int wifi_disable(struct connman_device *device)
wifi->connected = false;
wifi->disconnecting = false;
- if (wifi->pending_network)
+ if (wifi->pending_network) {
+ connman_network_unref(wifi->pending_network);
wifi->pending_network = NULL;
+ }
stop_autoscan(device);
@@ -2066,7 +2068,7 @@ static int network_connect(struct connman_network
*network)
ssid_init(ssid, network);
if (wifi->disconnecting) {
- wifi->pending_network = network;
+ wifi->pending_network = connman_network_ref(network);
g_free(ssid);
} else {
wifi->network = connman_network_ref(network);
@@ -2101,6 +2103,7 @@ static void disconnect_callback(int result,
GSupplicantInterface *interface,
if (wifi->pending_network) {
network_connect(wifi->pending_network);
+ connman_network_unref(wifi->pending_network);
wifi->pending_network = NULL;
}
--
2.1.4
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman