diff options
author | Christian Kandeler <christian.kandeler@nokia.com> | 2012-06-08 08:48:03 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@nokia.com> | 2012-06-08 12:41:31 +0200 |
commit | c310f1671cc08bed4d9de40f6526aeadf1739be8 (patch) | |
tree | 2d9f70c879f346e7f06b7044af3bf2443922d9a6 | |
parent | 92c7dce14f4ba1ffd5f5c63f5268238a4cf57a5a (diff) | |
download | qt-creator-c310f1671cc08bed4d9de40f6526aeadf1739be8.tar.gz |
SSH: Add parent object to SshConnection constructor.
There's no mandatory use of shared pointers anymore, so client code
should be able to make use of QObject-based ownership.
Change-Id: I2344ca66a40c310ef739b32502eb8471da98c03a
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
-rw-r--r-- | src/libs/ssh/sshconnection.cpp | 3 | ||||
-rw-r--r-- | src/libs/ssh/sshconnection.h | 2 | ||||
-rw-r--r-- | src/plugins/remotelinux/linuxdevicetester.cpp | 4 | ||||
-rw-r--r-- | src/plugins/valgrind/valgrindprocess.cpp | 4 |
4 files changed, 5 insertions, 8 deletions
diff --git a/src/libs/ssh/sshconnection.cpp b/src/libs/ssh/sshconnection.cpp index c6a1151d59..6f4cf24ec3 100644 --- a/src/libs/ssh/sshconnection.cpp +++ b/src/libs/ssh/sshconnection.cpp @@ -107,7 +107,8 @@ bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters // TODO: Mechanism for checking the host key. First connection to host: save, later: compare -SshConnection::SshConnection(const SshConnectionParameters &serverInfo) +SshConnection::SshConnection(const SshConnectionParameters &serverInfo, QObject *parent) + : QObject(parent) { doStaticInitializationsIfNecessary(); diff --git a/src/libs/ssh/sshconnection.h b/src/libs/ssh/sshconnection.h index c6a2fbc8d9..5354ec5946 100644 --- a/src/libs/ssh/sshconnection.h +++ b/src/libs/ssh/sshconnection.h @@ -91,7 +91,7 @@ class QSSH_EXPORT SshConnection : public QObject public: enum State { Unconnected, Connecting, Connected }; - SshConnection(const SshConnectionParameters &serverInfo); + explicit SshConnection(const SshConnectionParameters &serverInfo, QObject *parent = 0); void connectToHost(); void disconnectFromHost(); diff --git a/src/plugins/remotelinux/linuxdevicetester.cpp b/src/plugins/remotelinux/linuxdevicetester.cpp index 598cb45647..547d7731be 100644 --- a/src/plugins/remotelinux/linuxdevicetester.cpp +++ b/src/plugins/remotelinux/linuxdevicetester.cpp @@ -76,8 +76,6 @@ GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent) GenericLinuxDeviceTester::~GenericLinuxDeviceTester() { - if (d->connection) - d->connection->deleteLater(); delete d; } @@ -86,7 +84,7 @@ void GenericLinuxDeviceTester::testDevice(const LinuxDeviceConfiguration::ConstP QTC_ASSERT(d->state == Inactive, return); d->deviceConfiguration = deviceConfiguration; - d->connection = new SshConnection(deviceConfiguration->sshParameters()); + d->connection = new SshConnection(deviceConfiguration->sshParameters(), this); connect(d->connection, SIGNAL(connected()), SLOT(handleConnected())); connect(d->connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionFailure())); diff --git a/src/plugins/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrindprocess.cpp index d352ea34f3..641fd67ceb 100644 --- a/src/plugins/valgrind/valgrindprocess.cpp +++ b/src/plugins/valgrind/valgrindprocess.cpp @@ -167,8 +167,6 @@ RemoteValgrindProcess::RemoteValgrindProcess(QSsh::SshConnection *connection, QO RemoteValgrindProcess::~RemoteValgrindProcess() { - if (m_connection) - m_connection->deleteLater(); } bool RemoteValgrindProcess::isRunning() const @@ -186,7 +184,7 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString // connect to host and wait for connection if (!m_connection) - m_connection = new QSsh::SshConnection(m_params); + m_connection = new QSsh::SshConnection(m_params, this); if (m_connection->state() != QSsh::SshConnection::Connected) { connect(m_connection, SIGNAL(connected()), this, SLOT(connected())); |