summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/Session.cpp2
-rw-r--r--Swiften/Client/Session.h2
-rw-r--r--Swiften/Client/UnitTest/SessionTest.cpp8
3 files changed, 5 insertions, 7 deletions
diff --git a/Swiften/Client/Session.cpp b/Swiften/Client/Session.cpp
index 1ae97d6..087880f 100644
--- a/Swiften/Client/Session.cpp
+++ b/Swiften/Client/Session.cpp
@@ -31,7 +31,6 @@ Session::Session(const JID& jid, ConnectionFactory* connectionFactory, TLSLayerF
payloadSerializers_(payloadSerializers),
state_(Initial),
error_(NoError),
- connection_(0),
xmppLayer_(0),
tlsLayer_(0),
connectionLayer_(0),
@@ -46,7 +45,6 @@ Session::~Session() {
delete connectionLayer_;
delete tlsLayer_;
delete xmppLayer_;
- delete connection_;
}
void Session::start() {
diff --git a/Swiften/Client/Session.h b/Swiften/Client/Session.h
index 516cb5a..72b57bd 100644
--- a/Swiften/Client/Session.h
+++ b/Swiften/Client/Session.h
@@ -112,7 +112,7 @@ namespace Swift {
PayloadSerializerCollection* payloadSerializers_;
State state_;
SessionError error_;
- Connection* connection_;
+ boost::shared_ptr<Connection> connection_;
XMPPLayer* xmppLayer_;
TLSLayer* tlsLayer_;
ConnectionLayer* connectionLayer_;
diff --git a/Swiften/Client/UnitTest/SessionTest.cpp b/Swiften/Client/UnitTest/SessionTest.cpp
index da05a06..f7f1db0 100644
--- a/Swiften/Client/UnitTest/SessionTest.cpp
+++ b/Swiften/Client/UnitTest/SessionTest.cpp
@@ -428,7 +428,7 @@ class SessionTest : public CppUnit::TestFixture {
private:
struct MockConnection;
- MockConnection* getMockServer() const {
+ boost::shared_ptr<MockConnection> getMockServer() const {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(connectionFactory_->connections_.size()));
return connectionFactory_->connections_[0];
}
@@ -689,15 +689,15 @@ class SessionTest : public CppUnit::TestFixture {
struct MockConnectionFactory : public ConnectionFactory {
MockConnectionFactory() : fail_(false) {}
- MockConnection* createConnection() {
- MockConnection* result = new MockConnection(fail_);
+ boost::shared_ptr<Connection> createConnection() {
+ boost::shared_ptr<MockConnection> result(new MockConnection(fail_));
connections_.push_back(result);
return result;
}
void setCreateFailingConnections() {
fail_ = true;
}
- std::vector<MockConnection*> connections_;
+ std::vector<boost::shared_ptr<MockConnection> > connections_;
bool fail_;
};