summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-01-22 12:24:02 (GMT)
committerTobias Markmann <tm@ayena.de>2016-01-22 12:24:02 (GMT)
commit52e685379436794cc0e4c2687c35f5e69a2f09a7 (patch)
tree8306420ffd1c9cd221545fb1382b13fc0496c6be /SwifTools/Idle
parent8480bdda831e4d18c1979f40badb1bc985e78865 (diff)
downloadswift-52e685379436794cc0e4c2687c35f5e69a2f09a7.zip
swift-52e685379436794cc0e4c2687c35f5e69a2f09a7.tar.bz2
Add missing Timer related cleanup code
This commit adds explicit code to stop timers which are connected to objects that are about to be deleted from memory. Test-Information: ./scons test=system passes on OS X 10.11.3. Change-Id: I139314f3a223e3dc63b78b96be17d3ae53cd3de3
Diffstat (limited to 'SwifTools/Idle')
-rw-r--r--SwifTools/Idle/ActualIdleDetector.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/SwifTools/Idle/ActualIdleDetector.cpp b/SwifTools/Idle/ActualIdleDetector.cpp
index ba23b99..2e2f1f1 100644
--- a/SwifTools/Idle/ActualIdleDetector.cpp
+++ b/SwifTools/Idle/ActualIdleDetector.cpp
@@ -1,18 +1,19 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <SwifTools/Idle/ActualIdleDetector.h>
+
#include <boost/bind.hpp>
-#include <iostream>
-#include <SwifTools/Idle/IdleQuerier.h>
#include <Swiften/Network/Timer.h>
#include <Swiften/Network/TimerFactory.h>
+#include <SwifTools/Idle/IdleQuerier.h>
+
namespace Swift {
ActualIdleDetector::ActualIdleDetector(IdleQuerier* querier, TimerFactory* timerFactory, int refreshRateMilliseconds) : querier(querier) {
@@ -22,6 +23,7 @@ ActualIdleDetector::ActualIdleDetector(IdleQuerier* querier, TimerFactory* timer
}
ActualIdleDetector::~ActualIdleDetector() {
+ timer->onTick.disconnect(boost::bind(&ActualIdleDetector::handleTimerTick, this));
timer->stop();
}