__near_adapter_stop_check_presence() stops the neard check presence
timer but doesn't clear the timer handle.  This can cause neard to
try to stop the timer when it isn't running.  To fix that, clear the
handle so neard doesn't try to stop an already stopped timer.

Signed-off-by: Mark Greer <mgr...@animalcreek.com>
---
 src/adapter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 466753b..7be87e2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -505,8 +505,10 @@ void __near_adapter_stop_check_presence(uint32_t 
adapter_idx,
        if (!adapter)
                return;
 
-       if (adapter->presence_timeout > 0)
+       if (adapter->presence_timeout > 0) {
                g_source_remove(adapter->presence_timeout);
+               adapter->presence_timeout = 0;
+       }
 }
 
 static const GDBusMethodTable adapter_methods[] = {
-- 
2.13.0

Reply via email to