SSH: Use plain pointers to SshConnection objects.

It used to be shared pointers so that existing connection objects could
easily be passed around in order not to open a new connection to the same
server. Since the introduction of the SshConnectionManager, this
is no longer necessary.

Change-Id: I13fd3eceaf35d562e6260e9969abbffb01edd6b5
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Christian Kandeler
2012-05-29 13:22:33 +02:00
parent 6886dcb787
commit 94ab29519b
34 changed files with 198 additions and 177 deletions

View File

@@ -102,7 +102,7 @@ private:
Option m_lastOption;
// remote callgrind support
QSsh::SshConnection::Ptr m_ssh;
QSsh::SshConnection *m_ssh;
QString m_tempDataFile;
QSsh::SshRemoteProcess::Ptr m_findRemoteFile;
QSsh::SftpChannel::Ptr m_sftp;

View File

@@ -152,11 +152,12 @@ RemoteValgrindProcess::RemoteValgrindProcess(const QSsh::SshConnectionParameters
QObject *parent)
: ValgrindProcess(parent)
, m_params(sshParams)
, m_connection(0)
, m_error(QProcess::UnknownError)
, m_pid(0)
{}
RemoteValgrindProcess::RemoteValgrindProcess(const QSsh::SshConnection::Ptr &connection, QObject *parent)
RemoteValgrindProcess::RemoteValgrindProcess(QSsh::SshConnection *connection, QObject *parent)
: ValgrindProcess(parent)
, m_params(connection->connectionParameters())
, m_connection(connection)
@@ -164,6 +165,11 @@ RemoteValgrindProcess::RemoteValgrindProcess(const QSsh::SshConnection::Ptr &con
, m_pid(0)
{}
RemoteValgrindProcess::~RemoteValgrindProcess()
{
delete m_connection;
}
bool RemoteValgrindProcess::isRunning() const
{
return m_process && m_process->isRunning();
@@ -179,12 +185,11 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString
// connect to host and wait for connection
if (!m_connection)
m_connection = QSsh::SshConnection::create(m_params);
m_connection = new QSsh::SshConnection(m_params);
if (m_connection->state() != QSsh::SshConnection::Connected) {
connect(m_connection.data(), SIGNAL(connected()),
this, SLOT(connected()));
connect(m_connection.data(), SIGNAL(error(QSsh::SshError)),
connect(m_connection, SIGNAL(connected()), this, SLOT(connected()));
connect(m_connection, SIGNAL(error(QSsh::SshError)),
this, SLOT(error(QSsh::SshError)));
if (m_connection->state() == QSsh::SshConnection::Unconnected)
m_connection->connectToHost();
@@ -219,7 +224,7 @@ void RemoteValgrindProcess::connected()
m_process->start();
}
QSsh::SshConnection::Ptr RemoteValgrindProcess::connection() const
QSsh::SshConnection *RemoteValgrindProcess::connection() const
{
return m_connection;
}

View File

@@ -120,8 +120,9 @@ class RemoteValgrindProcess : public ValgrindProcess
public:
explicit RemoteValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
QObject *parent = 0);
explicit RemoteValgrindProcess(const QSsh::SshConnection::Ptr &connection,
explicit RemoteValgrindProcess(QSsh::SshConnection *connection,
QObject *parent = 0);
~RemoteValgrindProcess();
virtual bool isRunning() const;
@@ -139,7 +140,7 @@ public:
virtual qint64 pid() const;
QSsh::SshConnection::Ptr connection() const;
QSsh::SshConnection *connection() const;
private slots:
void closed(int);
@@ -152,7 +153,7 @@ private slots:
private:
QSsh::SshConnectionParameters m_params;
QSsh::SshConnection::Ptr m_connection;
QSsh::SshConnection *m_connection;
QSsh::SshRemoteProcess::Ptr m_process;
QString m_workingDir;
QString m_valgrindExe;