From: Patrik Flykt Date: Tue, 6 Sep 2011 07:13:17 +0000 (+0300) Subject: wifi: Device reference counting fix on scan X-Git-Tag: 2.0_alpha~1140 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8a0aef14616e3a3e1ca5ba9ba4295ebf95cf2899;p=framework%2Fconnectivity%2Fconnman.git wifi: Device reference counting fix on scan When starting to scan, up the reference count on struct connman_device and release it in the scan callback. --- diff --git a/plugins/wifi.c b/plugins/wifi.c index ee30586..db87f01 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -279,6 +279,7 @@ static void scan_callback(int result, GSupplicantInterface *interface, connman_device_reset_scanning(device); else connman_device_set_scanning(device, FALSE); + connman_device_unref(device); } static int wifi_scan(struct connman_device *device) @@ -291,10 +292,13 @@ static int wifi_scan(struct connman_device *device) if (wifi->tethering == TRUE) return 0; + connman_device_ref(device); ret = g_supplicant_interface_scan(wifi->interface, scan_callback, device); if (ret == 0) connman_device_set_scanning(device, TRUE); + else + connman_device_unref(device); return ret; }