From cda6fd478b3d8f7f30f771b18324db389a01b1b3 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Wed, 18 Nov 2015 15:08:45 +0100
Subject: Fix virtual destructors and mismatching signal disconnection

Test-Information:

Unit tests pass on OS X 10.10.5.

Change-Id: I7b505513b4342001596ee8518bfdcf9e77c91479

diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp
index 9a836cb..b04609f 100644
--- a/Swiften/Network/BOSHConnection.cpp
+++ b/Swiften/Network/BOSHConnection.cpp
@@ -91,7 +91,7 @@ void BOSHConnection::handleRawDataRead(boost::shared_ptr<SafeByteArray> data) {
 	tlsLayer_->handleDataRead(*data.get());
 }
 
-void BOSHConnection::handleTLSError(boost::shared_ptr<TLSError> error) {
+void BOSHConnection::handleTLSError(boost::shared_ptr<TLSError> /* error */) {
 
 }
 
diff --git a/Swiften/Network/PlatformDomainNameAddressQuery.cpp b/Swiften/Network/PlatformDomainNameAddressQuery.cpp
index 99e5eda..8b72c3b 100644
--- a/Swiften/Network/PlatformDomainNameAddressQuery.cpp
+++ b/Swiften/Network/PlatformDomainNameAddressQuery.cpp
@@ -8,8 +8,8 @@
 
 #include <boost/asio/ip/tcp.hpp>
 
-#include <Swiften/Network/PlatformDomainNameResolver.h>
 #include <Swiften/EventLoop/EventLoop.h>
+#include <Swiften/Network/PlatformDomainNameResolver.h>
 
 namespace Swift {
 
@@ -20,6 +20,10 @@ PlatformDomainNameAddressQuery::PlatformDomainNameAddressQuery(const boost::opti
 	}
 }
 
+PlatformDomainNameAddressQuery::~PlatformDomainNameAddressQuery() {
+	
+}
+
 void PlatformDomainNameAddressQuery::run() {
 	getResolver()->addQueryToQueue(shared_from_this());
 }
diff --git a/Swiften/Network/PlatformDomainNameAddressQuery.h b/Swiften/Network/PlatformDomainNameAddressQuery.h
index 306612c..c241f2a 100644
--- a/Swiften/Network/PlatformDomainNameAddressQuery.h
+++ b/Swiften/Network/PlatformDomainNameAddressQuery.h
@@ -1,18 +1,19 @@
 /*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
  * All rights reserved.
  * See the COPYING file for more information.
  */
 
 #pragma once
 
+#include <string>
+
 #include <boost/asio/io_service.hpp>
 #include <boost/enable_shared_from_this.hpp>
 
+#include <Swiften/EventLoop/EventOwner.h>
 #include <Swiften/Network/DomainNameAddressQuery.h>
 #include <Swiften/Network/PlatformDomainNameQuery.h>
-#include <Swiften/EventLoop/EventOwner.h>
-#include <string>
 
 namespace Swift {
 	class PlatformDomainNameResolver;
@@ -21,6 +22,7 @@ namespace Swift {
 	class PlatformDomainNameAddressQuery : public DomainNameAddressQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameAddressQuery>, public EventOwner {
 		public:
 			PlatformDomainNameAddressQuery(const boost::optional<std::string>& host, EventLoop* eventLoop, PlatformDomainNameResolver*);
+			virtual ~PlatformDomainNameAddressQuery();
 
 			void run();
 
diff --git a/Swiften/Network/PlatformDomainNameResolver.h b/Swiften/Network/PlatformDomainNameResolver.h
index e2d28a9..ae94179 100644
--- a/Swiften/Network/PlatformDomainNameResolver.h
+++ b/Swiften/Network/PlatformDomainNameResolver.h
@@ -7,16 +7,17 @@
 #pragma once
 
 #include <deque>
-#include <boost/thread/thread.hpp>
-#include <boost/thread/mutex.hpp>
+
 #include <boost/thread/condition_variable.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/thread.hpp>
 
 #include <Swiften/Base/API.h>
 #include <Swiften/Base/Atomic.h>
+#include <Swiften/Network/DomainNameAddressQuery.h>
 #include <Swiften/Network/DomainNameResolver.h>
-#include <Swiften/Network/PlatformDomainNameQuery.h>
 #include <Swiften/Network/DomainNameServiceQuery.h>
-#include <Swiften/Network/DomainNameAddressQuery.h>
+#include <Swiften/Network/PlatformDomainNameQuery.h>
 
 namespace Swift {
 	class IDNConverter;	
@@ -25,7 +26,7 @@ namespace Swift {
 	class SWIFTEN_API PlatformDomainNameResolver : public DomainNameResolver {
 		public:
 			PlatformDomainNameResolver(IDNConverter* idnConverter, EventLoop* eventLoop);
-			~PlatformDomainNameResolver();
+			virtual ~PlatformDomainNameResolver();
 
 			virtual DomainNameServiceQuery::ref createServiceQuery(const std::string& serviceLookupPrefix, const std::string& domain);
 			virtual DomainNameAddressQuery::ref createAddressQuery(const std::string& name);
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
index d68f4bf..673aaff 100644
--- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp
+++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
  * All rights reserved.
  * See the COPYING file for more information.
  */
@@ -45,6 +45,10 @@ PlatformDomainNameServiceQuery::PlatformDomainNameServiceQuery(const boost::opti
 	}
 }
 
+PlatformDomainNameServiceQuery::~PlatformDomainNameServiceQuery() {
+	
+}
+
 void PlatformDomainNameServiceQuery::run() {
 	getResolver()->addQueryToQueue(shared_from_this());
 }
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.h b/Swiften/Network/PlatformDomainNameServiceQuery.h
index 53d9f50..afc4a90 100644
--- a/Swiften/Network/PlatformDomainNameServiceQuery.h
+++ b/Swiften/Network/PlatformDomainNameServiceQuery.h
@@ -1,16 +1,17 @@
 /*
- * Copyright (c) 2010-2013 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
  * All rights reserved.
  * See the COPYING file for more information.
  */
 
 #pragma once
 
+#include <string>
+
 #include <boost/enable_shared_from_this.hpp>
 
-#include <Swiften/Network/DomainNameServiceQuery.h>
 #include <Swiften/EventLoop/EventOwner.h>
-#include <string>
+#include <Swiften/Network/DomainNameServiceQuery.h>
 #include <Swiften/Network/PlatformDomainNameQuery.h>
 
 namespace Swift {
@@ -19,6 +20,7 @@ namespace Swift {
 	class PlatformDomainNameServiceQuery : public DomainNameServiceQuery, public PlatformDomainNameQuery, public boost::enable_shared_from_this<PlatformDomainNameServiceQuery>, public EventOwner {
 		public:
 			PlatformDomainNameServiceQuery(const boost::optional<std::string>& serviceName, EventLoop* eventLoop, PlatformDomainNameResolver* resolver);
+			virtual ~PlatformDomainNameServiceQuery();
 
 			virtual void run();
 
diff --git a/Swiften/StreamStack/ConnectionLayer.cpp b/Swiften/StreamStack/ConnectionLayer.cpp
index 4546a9b..5bf07d0 100644
--- a/Swiften/StreamStack/ConnectionLayer.cpp
+++ b/Swiften/StreamStack/ConnectionLayer.cpp
@@ -1,10 +1,11 @@
 /*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
  * All rights reserved.
  * See the COPYING file for more information.
  */
 
 #include <Swiften/StreamStack/ConnectionLayer.h>
+
 #include <boost/bind.hpp>
 
 namespace Swift {
@@ -14,7 +15,7 @@ ConnectionLayer::ConnectionLayer(boost::shared_ptr<Connection> connection) : con
 }
 
 ConnectionLayer::~ConnectionLayer() {
-	connection->onDataRead.disconnect(boost::bind(&ConnectionLayer::writeDataToParentLayer, this, _1));
+	connection->onDataRead.disconnect(boost::bind(&ConnectionLayer::handleDataRead, this, _1));
 }
 
 void ConnectionLayer::handleDataRead(boost::shared_ptr<SafeByteArray> data) {
diff --git a/Swiften/StreamStack/ConnectionLayer.h b/Swiften/StreamStack/ConnectionLayer.h
index 2ff1c3c..e89e24c 100644
--- a/Swiften/StreamStack/ConnectionLayer.h
+++ b/Swiften/StreamStack/ConnectionLayer.h
@@ -9,14 +9,14 @@
 #include <boost/shared_ptr.hpp>
 
 #include <Swiften/Base/API.h>
-#include <Swiften/StreamStack/LowLayer.h>
 #include <Swiften/Network/Connection.h>
+#include <Swiften/StreamStack/LowLayer.h>
 
 namespace Swift {
 	class SWIFTEN_API ConnectionLayer : public LowLayer {
 		public:
 			ConnectionLayer(boost::shared_ptr<Connection> connection);
-			~ConnectionLayer();
+			virtual ~ConnectionLayer();
 
 			void writeData(const SafeByteArray& data) {
 				connection->write(data);
diff --git a/Swiften/StreamStack/TLSLayer.h b/Swiften/StreamStack/TLSLayer.h
index 87d69a9..0ab35d5 100644
--- a/Swiften/StreamStack/TLSLayer.h
+++ b/Swiften/StreamStack/TLSLayer.h
@@ -6,14 +6,13 @@
 
 #pragma once
 
-#include <Swiften/Base/boost_bsignals.h>
-
 #include <Swiften/Base/API.h>
 #include <Swiften/Base/SafeByteArray.h>
+#include <Swiften/Base/boost_bsignals.h>
 #include <Swiften/StreamStack/StreamLayer.h>
 #include <Swiften/TLS/Certificate.h>
-#include <Swiften/TLS/CertificateWithKey.h>
 #include <Swiften/TLS/CertificateVerificationError.h>
+#include <Swiften/TLS/CertificateWithKey.h>
 #include <Swiften/TLS/TLSError.h>
 #include <Swiften/TLS/TLSOptions.h>
 
@@ -24,7 +23,7 @@ namespace Swift {
 	class SWIFTEN_API TLSLayer : public StreamLayer {
 		public:
 			TLSLayer(TLSContextFactory*, const TLSOptions&);
-			~TLSLayer();
+			virtual ~TLSLayer();
 
 			void connect();
 			bool setClientCertificate(CertificateWithKey::ref cert);
-- 
cgit v0.10.2-6-g49f6