Remove Wi-Fi device reference on wifi_disable when wifi is scanning 28/215028/2 accepted/tizen/unified/20191007.234805 submit/tizen/20191001.114836
authorYu <jiung.yu@samsung.com>
Tue, 1 Oct 2019 05:44:11 +0000 (14:44 +0900)
committerYu <jiung.yu@samsung.com>
Tue, 1 Oct 2019 08:25:32 +0000 (17:25 +0900)
Description: Sometimes Wi-Fi device reference didn't set to zero
when Wi-Fi is powered off like below.

src/device.c:connman_device_ref_debug() 0xb7fd8ae0 ref 2 by plugins/wifi.c:1434:wifi_probe()
src/device.c:connman_device_ref_debug() 0xb7fd8ae0 ref 3 by plugins/wifi.c:3183:wifi_scan()
src/device.c:connman_device_ref_debug() 0xb7fd8ae0 ref 4 by plugins/wifi.c:2313:start_autoscan()
src/device.c:connman_device_unref_debug() 0xb7fd8ae0 ref 3 by plugins/wifi.c:1500:reset_autoscan()
src/device.c:connman_device_unref_debug() 0xb7fd8ae0 ref 2 by plugins/wifi.c:1606:wifi_remove()
src/device.c:connman_device_unref_debug() 0xb7fd8ae0 ref 1 by src/detect.c:106:detect_dellink()

src/device.c:connman_device_ref_debug() 0xb7fd8ae0 ref 2 by plugins/wifi.c:1434:wifi_probe()
src/device.c:connman_device_ref_debug() 0xb7fcce88 ref 2 by plugins/wifi.c:1434:wifi_probe()
src/device.c:connman_device_unref_debug() 0xb7fcce88 ref 1 by plugins/wifi.c:1606:wifi_remove()
src/device.c:connman_device_unref_debug() 0xb7fcce88 ref 0 by src/detect.c:106:detect_dellink()

Change-Id: I52783152a5dd581d1af072aa5f3a0db92e8d622a
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
plugins/wifi.c

index dd58a44..e74e2d9 100644 (file)
@@ -2479,7 +2479,9 @@ static int wifi_disable(struct connman_device *device)
        if (wifi->pending_network)
                wifi->pending_network = NULL;
 
+#if !defined TIZEN_EXT
        stop_autoscan(device);
+#endif
 
        if (connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_P2P)) {
                g_source_remove(wifi->p2p_find_timeout);
@@ -2502,6 +2504,10 @@ static int wifi_disable(struct connman_device *device)
                connman_device_unref(wifi->device);
        }
 
+#if defined TIZEN_EXT
+       stop_autoscan(device);
+#endif
+
        remove_networks(device, wifi);
        remove_peers(wifi);