summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2014-03-08 08:28:20 (GMT)
committerSwift Review <review@swift.im>2014-03-21 09:57:37 (GMT)
commit7c2639d131a62496a5d0ba894e63a314ed2012d6 (patch)
tree58f5809e3f8950c343800b9e11e88194a963f892 /Swiften
parenta51044193098128f615287308240edd0611a2e4b (diff)
downloadswift-contrib-7c2639d131a62496a5d0ba894e63a314ed2012d6.zip
swift-contrib-7c2639d131a62496a5d0ba894e63a314ed2012d6.tar.bz2
Disconnect ClientXMLTracer signals at destruction time
This fixes a crash when disabling the XML tracer. Change-Id: Id26255610e71809901409e42d5a61b18e502d8f6
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Client/ClientXMLTracer.cpp6
-rw-r--r--Swiften/Client/ClientXMLTracer.h5
2 files changed, 7 insertions, 4 deletions
diff --git a/Swiften/Client/ClientXMLTracer.cpp b/Swiften/Client/ClientXMLTracer.cpp
index b413f40..9bfa047 100644
--- a/Swiften/Client/ClientXMLTracer.cpp
+++ b/Swiften/Client/ClientXMLTracer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -19,8 +19,8 @@ ClientXMLTracer::ClientXMLTracer(CoreClient* client, bool bosh) : bosh(bosh) {
#else
beautifier = new XMLBeautifier(true, true);
#endif
- client->onDataRead.connect(boost::bind(&ClientXMLTracer::printData, this, '<', _1));
- client->onDataWritten.connect(boost::bind(&ClientXMLTracer::printData, this, '>', _1));
+ onDataReadConnection = client->onDataRead.connect(boost::bind(&ClientXMLTracer::printData, this, '<', _1));
+ onDataWrittenConnection = client->onDataWritten.connect(boost::bind(&ClientXMLTracer::printData, this, '>', _1));
}
ClientXMLTracer::~ClientXMLTracer() {
diff --git a/Swiften/Client/ClientXMLTracer.h b/Swiften/Client/ClientXMLTracer.h
index 91cfe22..95e2f6f 100644
--- a/Swiften/Client/ClientXMLTracer.h
+++ b/Swiften/Client/ClientXMLTracer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -16,6 +16,7 @@ namespace Swift {
public:
ClientXMLTracer(CoreClient* client, bool bosh = false);
~ClientXMLTracer();
+
private:
void printData(char direction, const SafeByteArray& data);
void printLine(char c);
@@ -23,5 +24,7 @@ namespace Swift {
private:
XMLBeautifier *beautifier;
bool bosh;
+ boost::bsignals::scoped_connection onDataReadConnection;
+ boost::bsignals::scoped_connection onDataWrittenConnection;
};
}