diff options
author | Tobias Markmann <tm@ayena.de> | 2015-07-17 08:18:04 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-07-20 11:24:07 (GMT) |
commit | f10bd4cc1f570b27943d27e536d1dcfbcd55ec6a (patch) | |
tree | eaa855d6b961ea70c854db571ace7127a36f9d8c /Swiften/Client | |
parent | 3e982c0a39d1d1833afaf558fc7b0f7aeffd2d64 (diff) | |
download | swift-f10bd4cc1f570b27943d27e536d1dcfbcd55ec6a.zip swift-f10bd4cc1f570b27943d27e536d1dcfbcd55ec6a.tar.bz2 |
Do not reallocate FileTransferManager on connect of Clientswift-3.0beta2
Now Client allocates a FileTransferManager in its ctor and frees
it in its dtor, like all the other resources of the Client class.
This fixes an ASAN crash in the use case where you do a file
transfer, go offline and online again and try to start another
file transfer.
Test-Information:
Tested that the mentioned use case does not crash anymore,
that file transfers still work, and that FileTransferTest still
passes.
Change-Id: Iddbcd8522af7df528bdc2b030fe616ad3f0c4701
Diffstat (limited to 'Swiften/Client')
-rw-r--r-- | Swiften/Client/Client.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp index 613249b..3bfdd3f 100644 --- a/Swiften/Client/Client.cpp +++ b/Swiften/Client/Client.cpp @@ -71,7 +71,6 @@ Client::Client(const JID& jid, const SafeString& password, NetworkFactories* net jingleSessionManager = new JingleSessionManager(getIQRouter()); blockListManager = new ClientBlockListManager(getIQRouter()); - fileTransferManager = NULL; whiteboardSessionManager = NULL; #ifdef SWIFT_EXPERIMENTAL_WB @@ -79,6 +78,24 @@ Client::Client(const JID& jid, const SafeString& password, NetworkFactories* net #endif pubsubManager = new PubSubManagerImpl(getStanzaChannel(), getIQRouter()); + +#ifdef SWIFT_EXPERIMENTAL_FT + fileTransferManager = new FileTransferManagerImpl( + getJID(), + jingleSessionManager, + getIQRouter(), + getEntityCapsProvider(), + presenceOracle, + getNetworkFactories()->getConnectionFactory(), + getNetworkFactories()->getConnectionServerFactory(), + getNetworkFactories()->getTimerFactory(), + getNetworkFactories()->getDomainNameResolver(), + getNetworkFactories()->getNetworkEnvironment(), + getNetworkFactories()->getNATTraverser(), + getNetworkFactories()->getCryptoProvider()); +#else + fileTransferManager = new DummyFileTransferManager(); +#endif } Client::~Client() { @@ -126,24 +143,6 @@ void Client::setSoftwareVersion(const std::string& name, const std::string& vers } void Client::handleConnected() { - delete fileTransferManager; -#ifdef SWIFT_EXPERIMENTAL_FT - fileTransferManager = new FileTransferManagerImpl( - getJID(), - jingleSessionManager, - getIQRouter(), - getEntityCapsProvider(), - presenceOracle, - getNetworkFactories()->getConnectionFactory(), - getNetworkFactories()->getConnectionServerFactory(), - getNetworkFactories()->getTimerFactory(), - getNetworkFactories()->getDomainNameResolver(), - getNetworkFactories()->getNetworkEnvironment(), - getNetworkFactories()->getNATTraverser(), - getNetworkFactories()->getCryptoProvider()); -#else - fileTransferManager = new DummyFileTransferManager(); -#endif discoManager->handleConnected(); } |