forked from qt-creator/qt-creator
Control the lifetime of SshProcessManager
Make it possible to control when the SshProcessManager is being constructed / destructed. Expose public constructor. Since different singletons depend on each other, we need to control the order of creation and destruction of them. The order of creation is like that: 1. QCoreApplication 2. ProcessReaper 3. ProcessLauncher 4. SshConnectionManager The order of destruction must be opposite to the above. Change-Id: Ice07eb751cd61c03cb461816fa1b74ab040a53de Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -100,7 +100,7 @@ void SshRemoteProcessRunner::runInternal(const QString &command,
|
||||
d->m_processErrorString.clear();
|
||||
d->m_exitCode = -1;
|
||||
d->m_command = command;
|
||||
d->m_connection = QSsh::acquireConnection(sshParams);
|
||||
d->m_connection = SshConnectionManager::acquireConnection(sshParams);
|
||||
connect(d->m_connection, &SshConnection::errorOccurred,
|
||||
this, &SshRemoteProcessRunner::handleConnectionError);
|
||||
connect(d->m_connection, &SshConnection::disconnected,
|
||||
@@ -190,7 +190,7 @@ void SshRemoteProcessRunner::setState(int newState)
|
||||
}
|
||||
if (d->m_connection) {
|
||||
disconnect(d->m_connection, nullptr, this, nullptr);
|
||||
QSsh::releaseConnection(d->m_connection);
|
||||
SshConnectionManager::releaseConnection(d->m_connection);
|
||||
d->m_connection = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user