diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2012-04-24 18:10:00 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-04-24 17:09:50 +0200 |
commit | 604a5272c1be29048377856e4f655af354942c55 (patch) | |
tree | 12acdd10dba6f089e5a68620e9def6bcfa2862bc /plugins/wifi.c | |
parent | 1c249af7946667f24cd2b995cc13149b77dd62df (diff) | |
download | connman-604a5272c1be29048377856e4f655af354942c55.tar.gz connman-604a5272c1be29048377856e4f655af354942c55.tar.bz2 connman-604a5272c1be29048377856e4f655af354942c55.zip |
wifi: Fixing autoscan device unref issues
- stop_autoscan() should unref the device only when relevant, i.e. when
interval and/or timeout have been set.
- autoscan_scan_callback() should unref the device since it has been
referenced in throw_wifi_scan()
Diffstat (limited to 'plugins/wifi.c')
-rw-r--r-- | plugins/wifi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index 28b3563f..9ce380b0 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -214,8 +214,10 @@ static void stop_autoscan(struct connman_device *device) autoscan = wifi->autoscan; - if (autoscan->timeout > 0) - g_source_remove(autoscan->timeout); + if (autoscan->timeout == 0 && autoscan->interval == 0) + return; + + g_source_remove(autoscan->timeout); autoscan->timeout = 0; autoscan->interval = 0; @@ -281,6 +283,7 @@ static void autoscan_scan_callback(int result, DBG(""); connman_device_set_scanning(device, FALSE); + connman_device_unref(device); } static gboolean autoscan_timeout(gpointer data) |