summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-05-24 13:15:31 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-05-24 18:16:22 (GMT)
commit23387492f571e8e6c46c6fa6196bf496249c9853 (patch)
tree2ad95f6072367496383195f83a12a5be8fa2da40 /Swiften/Network/Connector.cpp
parent4b5d81c77aa37b9d4ce49f19aa4ef71fa482313b (diff)
downloadswift-23387492f571e8e6c46c6fa6196bf496249c9853.zip
swift-23387492f571e8e6c46c6fa6196bf496249c9853.tar.bz2
Make connector shared to avoid a crash on login.
Resolves: #346
Diffstat (limited to 'Swiften/Network/Connector.cpp')
-rw-r--r--Swiften/Network/Connector.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp
index 056a075..34fdf0b 100644
--- a/Swiften/Network/Connector.cpp
+++ b/Swiften/Network/Connector.cpp
@@ -30,10 +30,10 @@ void Connector::start() {
assert(!timer);
queriedAllServices = false;
serviceQuery = resolver->createServiceQuery("_xmpp-client._tcp." + hostname);
- serviceQuery->onResult.connect(boost::bind(&Connector::handleServiceQueryResult, this, _1));
+ serviceQuery->onResult.connect(boost::bind(&Connector::handleServiceQueryResult, shared_from_this(), _1));
if (timeoutMilliseconds > 0) {
timer = timerFactory->createTimer(timeoutMilliseconds);
- timer->onTick.connect(boost::bind(&Connector::handleTimeout, this));
+ timer->onTick.connect(boost::bind(&Connector::handleTimeout, shared_from_this()));
timer->start();
}
serviceQuery->run();
@@ -42,7 +42,7 @@ void Connector::start() {
void Connector::queryAddress(const String& hostname) {
assert(!addressQuery);
addressQuery = resolver->createAddressQuery(hostname);
- addressQuery->onResult.connect(boost::bind(&Connector::handleAddressQueryResult, this, _1, _2));
+ addressQuery->onResult.connect(boost::bind(&Connector::handleAddressQueryResult, shared_from_this(), _1, _2));
addressQuery->run();
}
@@ -112,7 +112,7 @@ void Connector::tryConnect(const HostAddressPort& target) {
assert(!currentConnection);
//std::cout << "Connector::tryConnect() " << target.getAddress().toString() << " " << target.getPort() << std::endl;
currentConnection = connectionFactory->createConnection();
- currentConnection->onConnectFinished.connect(boost::bind(&Connector::handleConnectionConnectFinished, this, _1));
+ currentConnection->onConnectFinished.connect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1));
currentConnection->connect(target);
}