summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-15 07:42:18 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-15 07:42:18 (GMT)
commit0930cd940963be0edfe7c80b4925babca0e01443 (patch)
treeb2a57761bfdf1a14ea75ea1a9871c70d85ff8024 /Swiften/StreamStack
parentd2625df30861a4caa984031a6990d19dfebc3367 (diff)
downloadswift-0930cd940963be0edfe7c80b4925babca0e01443.zip
swift-0930cd940963be0edfe7c80b4925babca0e01443.tar.bz2
Use shared_ptr for EventLoop owners.
Diffstat (limited to 'Swiften/StreamStack')
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.cpp10
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.h9
2 files changed, 6 insertions, 13 deletions
diff --git a/Swiften/StreamStack/WhitespacePingLayer.cpp b/Swiften/StreamStack/WhitespacePingLayer.cpp
index b9fbbd1..b10ba1a 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.cpp
+++ b/Swiften/StreamStack/WhitespacePingLayer.cpp
@@ -6,13 +6,9 @@ namespace Swift {
static const int TIMEOUT_MILLISECONDS = 60000;
WhitespacePingLayer::WhitespacePingLayer() {
- timer_ = new Timer(TIMEOUT_MILLISECONDS);
- timer_->onTick.connect(boost::bind(&WhitespacePingLayer::handleTimerTick, this));
- timer_->start();
-}
-
-WhitespacePingLayer::~WhitespacePingLayer() {
- delete timer_;
+ timer = boost::shared_ptr<Timer>(new Timer(TIMEOUT_MILLISECONDS));
+ timer->onTick.connect(boost::bind(&WhitespacePingLayer::handleTimerTick, this));
+ timer->start();
}
void WhitespacePingLayer::writeData(const ByteArray& data) {
diff --git a/Swiften/StreamStack/WhitespacePingLayer.h b/Swiften/StreamStack/WhitespacePingLayer.h
index 01fd3e3..ed0648b 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.h
+++ b/Swiften/StreamStack/WhitespacePingLayer.h
@@ -1,7 +1,7 @@
-#ifndef SWIFTEN_WhitespacePingLayer_H
-#define SWIFTEN_WhitespacePingLayer_H
+#pragma once
#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
#include "Swiften/StreamStack/StreamLayer.h"
@@ -11,7 +11,6 @@ namespace Swift {
class WhitespacePingLayer : public StreamLayer, boost::noncopyable {
public:
WhitespacePingLayer();
- ~WhitespacePingLayer();
void writeData(const ByteArray& data);
void handleDataRead(const ByteArray& data);
@@ -20,8 +19,6 @@ namespace Swift {
void handleTimerTick();
private:
- Timer* timer_;
+ boost::shared_ptr<Timer> timer;
};
}
-
-#endif