diff options
author | Zeeshan Ali <zeeshanak@gnome.org> | 2019-10-09 11:52:52 +0200 |
---|---|---|
committer | Zeeshan Ali <zeeshanak@gnome.org> | 2020-02-26 14:10:12 +0100 |
commit | 9aebd9f29a13f0e3983aa2752472a081a1bc3b3d (patch) | |
tree | 6beeb7d4742f698ed1f87427684c1c07cf18c66c | |
parent | 46a23cede8c20045993f21dfa78dfda6c5929f17 (diff) | |
download | geoclue-9aebd9f29a13f0e3983aa2752472a081a1bc3b3d.tar.gz |
wifi: Remove failable checks before clearing state
If my logic is wrong anywhere, the interface proxy might already be NULL
before disconnect_bss_signals() is called so let's not check for that
before clearing the timeout.
This hopefully fixes a crash on wifi scan timeout being called after the
wifi object is destroyed.
-rw-r--r-- | src/gclue-wifi.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gclue-wifi.c b/src/gclue-wifi.c index 1fcfa93..6d862fd 100644 --- a/src/gclue-wifi.c +++ b/src/gclue-wifi.c @@ -550,14 +550,18 @@ disconnect_bss_signals (GClueWifi *wifi) { GClueWifiPrivate *priv = wifi->priv; - if (priv->bss_added_id == 0 || priv->interface == NULL) - return; - cancel_wifi_scan (wifi); - g_signal_handler_disconnect (priv->interface, priv->bss_added_id); - priv->bss_added_id = 0; - g_signal_handler_disconnect (priv->interface, priv->bss_removed_id); - priv->bss_removed_id = 0; + + if (priv->bss_added_id != 0) { + g_signal_handler_disconnect (priv->interface, + priv->bss_added_id); + priv->bss_added_id = 0; + } + if (priv->bss_removed_id != 0) { + g_signal_handler_disconnect (priv->interface, + priv->bss_removed_id); + priv->bss_removed_id = 0; + } g_hash_table_remove_all (priv->bss_proxies); g_hash_table_remove_all (priv->ignored_bss_proxies); |