diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-09-10 15:02:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-09-11 21:53:46 (GMT) |
commit | 5fa9ecb3dff1a5918c202b72a5db313c0b7b879a (patch) | |
tree | efd7abfd306e5e2f773bdc62c7bf1ed491c5c410 /Swiften/Client/ClientSession.cpp | |
parent | bc6a510af449b6e383a11fc20c9859b8bcac247c (diff) | |
download | swift-contrib-5fa9ecb3dff1a5918c202b72a5db313c0b7b879a.zip swift-contrib-5fa9ecb3dff1a5918c202b72a5db313c0b7b879a.tar.bz2 |
Fixed some memory leaks.
Diffstat (limited to 'Swiften/Client/ClientSession.cpp')
-rw-r--r-- | Swiften/Client/ClientSession.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp index daffbc6..17b3931 100644 --- a/Swiften/Client/ClientSession.cpp +++ b/Swiften/Client/ClientSession.cpp @@ -56,10 +56,10 @@ ClientSession::~ClientSession() { } void ClientSession::start() { - stream->onStreamStartReceived.connect(boost::bind(&ClientSession::handleStreamStart, shared_from_this(), _1)); - stream->onElementReceived.connect(boost::bind(&ClientSession::handleElement, shared_from_this(), _1)); - stream->onError.connect(boost::bind(&ClientSession::handleStreamError, shared_from_this(), _1)); - stream->onTLSEncrypted.connect(boost::bind(&ClientSession::handleTLSEncrypted, shared_from_this())); + streamOnStreamStartReceivedConnection = stream->onStreamStartReceived.connect(boost::bind(&ClientSession::handleStreamStart, shared_from_this(), _1)); + streamOnElementReceivedConnection = stream->onElementReceived.connect(boost::bind(&ClientSession::handleElement, shared_from_this(), _1)); + streamOnErrorConnection = stream->onError.connect(boost::bind(&ClientSession::handleStreamError, shared_from_this(), _1)); + streamOnTLSEncryptedConnection = stream->onTLSEncrypted.connect(boost::bind(&ClientSession::handleTLSEncrypted, shared_from_this())); assert(state == Initial); state = WaitingForStreamStart; @@ -347,6 +347,10 @@ void ClientSession::finishSession(Error::Type error) { void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) { state = Finished; stream->setWhitespacePingEnabled(false); + streamOnStreamStartReceivedConnection.disconnect(); + streamOnElementReceivedConnection.disconnect(); + streamOnErrorConnection.disconnect(); + streamOnTLSEncryptedConnection.disconnect(); onFinished(error); } |