diff options
Diffstat (limited to 'Swiften/StreamStack/WhitespacePingLayer.cpp')
-rw-r--r-- | Swiften/StreamStack/WhitespacePingLayer.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Swiften/StreamStack/WhitespacePingLayer.cpp b/Swiften/StreamStack/WhitespacePingLayer.cpp index 00b931b..5ea5423 100644 --- a/Swiften/StreamStack/WhitespacePingLayer.cpp +++ b/Swiften/StreamStack/WhitespacePingLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,8 +8,9 @@ #include <boost/bind.hpp> -#include <Swiften/Network/TimerFactory.h> +#include <Swiften/Base/Log.h> #include <Swiften/Network/Timer.h> +#include <Swiften/Network/TimerFactory.h> namespace Swift { @@ -20,6 +21,14 @@ WhitespacePingLayer::WhitespacePingLayer(TimerFactory* timerFactory) : isActive( timer->onTick.connect(boost::bind(&WhitespacePingLayer::handleTimerTick, this)); } +WhitespacePingLayer::~WhitespacePingLayer() { + SWIFT_LOG_ASSERT(!isActive, debug) << "WhitespacePingLayer still active at destruction." << std::endl; + if (isActive) { + timer->stop(); + } + timer->onTick.disconnect(boost::bind(&WhitespacePingLayer::handleTimerTick, this)); +} + void WhitespacePingLayer::writeData(const SafeByteArray& data) { writeDataToChildLayer(data); } |