diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-01-29 09:34:06 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-02-02 13:33:08 +0000 |
commit | 4e1d375dc8f8849582aca147b63432bc9bb3deb4 (patch) | |
tree | 6333fcd9790ee11ff77dd1d3886a8083df77ac01 /src/libs/installer | |
parent | 92b238a41ef5d781ad4db722b6f69ec920864f69 (diff) |
Make sure RemoteServerConnection is properly shut down
QThreadServerConnection is automatically deleted via deleteLater on exit.
Anyhow, TcpServer::shutdown() also tries to quit() all child threads by
going through the list of children. Making the QThread a child of TcpServer
activates this behavior again.
Change-Id: If1639ae2c9cd74a83b8ff1814aa2131d9016de14
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'src/libs/installer')
-rw-r--r-- | src/libs/installer/remoteserver_p.h | 2 | ||||
-rw-r--r-- | src/libs/installer/remoteserverconnection.cpp | 6 | ||||
-rw-r--r-- | src/libs/installer/remoteserverconnection.h | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/libs/installer/remoteserver_p.h b/src/libs/installer/remoteserver_p.h index e210feb1e..431641188 100644 --- a/src/libs/installer/remoteserver_p.h +++ b/src/libs/installer/remoteserver_p.h @@ -84,7 +84,7 @@ private: if (m_shutdown) return; - QThread *const thread = new RemoteServerConnection(socketDescriptor, m_key); + QThread *const thread = new RemoteServerConnection(socketDescriptor, m_key, this); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); connect(thread, SIGNAL(shutdownRequested()), this, SLOT(shutdown())); thread->start(); diff --git a/src/libs/installer/remoteserverconnection.cpp b/src/libs/installer/remoteserverconnection.cpp index ad6d89bad..7bd4a45e8 100644 --- a/src/libs/installer/remoteserverconnection.cpp +++ b/src/libs/installer/remoteserverconnection.cpp @@ -44,8 +44,10 @@ namespace QInstaller { -RemoteServerConnection::RemoteServerConnection(qintptr socketDescriptor, const QString &key) - : m_socketDescriptor(socketDescriptor) +RemoteServerConnection::RemoteServerConnection(qintptr socketDescriptor, const QString &key, + QObject *parent) + : QThread(parent) + , m_socketDescriptor(socketDescriptor) , m_process(0) , m_engine(0) , m_authorizationKey(key) diff --git a/src/libs/installer/remoteserverconnection.h b/src/libs/installer/remoteserverconnection.h index 70afaeceb..b7c428c27 100644 --- a/src/libs/installer/remoteserverconnection.h +++ b/src/libs/installer/remoteserverconnection.h @@ -56,7 +56,8 @@ class RemoteServerConnection : public QThread Q_DISABLE_COPY(RemoteServerConnection) public: - RemoteServerConnection(qintptr socketDescriptor, const QString &authorizationKey); + RemoteServerConnection(qintptr socketDescriptor, const QString &authorizationKey, + QObject *parent); void run() Q_DECL_OVERRIDE; |