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:
@@ -72,7 +72,7 @@ GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent)
|
||||
GenericLinuxDeviceTester::~GenericLinuxDeviceTester()
|
||||
{
|
||||
if (d->connection)
|
||||
releaseConnection(d->connection);
|
||||
SshConnectionManager::releaseConnection(d->connection);
|
||||
delete d;
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ void GenericLinuxDeviceTester::testDevice(const IDevice::Ptr &deviceConfiguratio
|
||||
QTC_ASSERT(d->state == Inactive, return);
|
||||
|
||||
d->deviceConfiguration = deviceConfiguration;
|
||||
forceNewConnection(deviceConfiguration->sshParameters());
|
||||
d->connection = acquireConnection(deviceConfiguration->sshParameters());
|
||||
SshConnectionManager::forceNewConnection(deviceConfiguration->sshParameters());
|
||||
d->connection = SshConnectionManager::acquireConnection(deviceConfiguration->sshParameters());
|
||||
connect(d->connection, &SshConnection::connected,
|
||||
this, &GenericLinuxDeviceTester::handleConnected);
|
||||
connect(d->connection, &SshConnection::errorOccurred,
|
||||
@@ -275,7 +275,7 @@ void GenericLinuxDeviceTester::setFinished(TestResult result)
|
||||
}
|
||||
if (d->connection) {
|
||||
disconnect(d->connection, nullptr, this, nullptr);
|
||||
releaseConnection(d->connection);
|
||||
SshConnectionManager::releaseConnection(d->connection);
|
||||
d->connection = nullptr;
|
||||
}
|
||||
emit finished(result);
|
||||
|
||||
Reference in New Issue
Block a user