Install LocalAddressFinder also as stop dependency

The LocalAddressFinder was installed as a start dependency
for MemcheckToolRunner. However, it wasn't registered as
stop dependency for it. This means that when
MemcheckToolRunner was finished, its RunControl couldn't
finish as one of its RunWorkers wasn't finished yet.

Install LocalAddressFinder as a stop dependency and
implement a stop() method which disconnects the conneciton.

This also prevents the ApplicationOutput pane to open
a new tab on successive run of Memcheck for the same
application.

Fixes: QTCREATORBUG-26758
Change-Id: Ib71ddbe787e5c1bcc7b96687ebf15c9b63b714dc
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2021-12-17 16:13:03 +01:00
parent 13789ce2f9
commit 46db545a90

View File

@@ -166,6 +166,12 @@ public:
connection.connectToHost();
}
void stop() override
{
connection.disconnectFromHost();
reportStopped();
}
QSsh::SshConnection connection;
};
@@ -1170,8 +1176,11 @@ MemcheckToolRunner::MemcheckToolRunner(RunControl *runControl)
}
// We need a real address to connect to from the outside.
if (device()->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
addStartDependency(new LocalAddressFinder(runControl, &m_localServerAddress));
if (device()->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
auto *dependentWorker = new LocalAddressFinder(runControl, &m_localServerAddress);
addStartDependency(dependentWorker);
addStopDependency(dependentWorker);
}
dd->setupRunner(this);
}