From b9535a45e856213050ec1e73539a68ebcc0f801e Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Thu, 25 Jun 2015 23:42:45 +0200 Subject: Explicitly disconnect early from signals in candidate generator This is an attempt to fix crash reports with a segmentation fault on call of onLocalTransportCandidatesGenerated(). Test-Information: Tested that file-transfer still works. Change-Id: I415be0d8bc5fa15dcd68d0794ee2478a0d836f27 diff --git a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp index 6ef0e6a..fd0e571 100644 --- a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp +++ b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp @@ -73,13 +73,21 @@ void LocalJingleTransportCandidateGenerator::start() { } void LocalJingleTransportCandidateGenerator::stop() { + s5bProxy->onDiscoveredProxiesChanged.disconnect(boost::bind(&LocalJingleTransportCandidateGenerator::handleDiscoveredProxiesChanged, this)); + if (s5bServerPortForwardingUser_) { + s5bServerPortForwardingUser_->onSetup.disconnect(boost::bind(&LocalJingleTransportCandidateGenerator::handlePortForwardingSetup, this, _1)); + s5bServerPortForwardingUser_.reset(); + } if (s5bServerResourceUser_) { s5bServerResourceUser_->onSuccessfulInitialized.disconnect(boost::bind(&LocalJingleTransportCandidateGenerator::handleS5BServerInitialized, this, _1)); + s5bServerResourceUser_.reset(); } - s5bServerResourceUser_.reset(); } void LocalJingleTransportCandidateGenerator::handleS5BServerInitialized(bool success) { + if (s5bServerResourceUser_) { + s5bServerResourceUser_->onSuccessfulInitialized.disconnect(boost::bind(&LocalJingleTransportCandidateGenerator::handleS5BServerInitialized, this, _1)); + } triedServerInit_ = true; if (success) { if (options_.isAssistedAllowed()) { @@ -111,7 +119,9 @@ void LocalJingleTransportCandidateGenerator::handlePortForwardingSetup(bool /* s } void LocalJingleTransportCandidateGenerator::handleDiscoveredProxiesChanged() { - s5bProxy->onDiscoveredProxiesChanged.disconnect(boost::bind(&LocalJingleTransportCandidateGenerator::handleDiscoveredProxiesChanged, this)); + if (s5bProxy) { + s5bProxy->onDiscoveredProxiesChanged.disconnect(boost::bind(&LocalJingleTransportCandidateGenerator::handleDiscoveredProxiesChanged, this)); + } triedProxyDiscovery_ = true; checkS5BCandidatesReady(); } -- cgit v0.10.2-6-g49f6