forked from qt-creator/qt-creator
Fix multiple connections on runner restarted
Change-Id: I5ea243d9f5d2266500378381b78c0b2610261f14 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -177,6 +177,13 @@ PortsGatherer::PortsGatherer(RunControl *runControl)
|
|||||||
: RunWorker(runControl)
|
: RunWorker(runControl)
|
||||||
{
|
{
|
||||||
setDisplayName("PortGatherer");
|
setDisplayName("PortGatherer");
|
||||||
|
|
||||||
|
connect(&m_portsGatherer, &DeviceUsedPortsGatherer::error, this, &PortsGatherer::reportFailure);
|
||||||
|
connect(&m_portsGatherer, &DeviceUsedPortsGatherer::portListReady, this, [this] {
|
||||||
|
m_portList = device()->freePorts();
|
||||||
|
appendMessage(tr("Found %n free ports.", nullptr, m_portList.count()), NormalMessageFormat);
|
||||||
|
reportStarted();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
PortsGatherer::~PortsGatherer()
|
PortsGatherer::~PortsGatherer()
|
||||||
@@ -185,15 +192,7 @@ PortsGatherer::~PortsGatherer()
|
|||||||
|
|
||||||
void PortsGatherer::start()
|
void PortsGatherer::start()
|
||||||
{
|
{
|
||||||
appendMessage(tr("Checking available ports...") + '\n', NormalMessageFormat);
|
appendMessage(tr("Checking available ports..."), NormalMessageFormat);
|
||||||
connect(&m_portsGatherer, &DeviceUsedPortsGatherer::error, this, [this](const QString &msg) {
|
|
||||||
reportFailure(msg);
|
|
||||||
});
|
|
||||||
connect(&m_portsGatherer, &DeviceUsedPortsGatherer::portListReady, this, [this] {
|
|
||||||
m_portList = device()->freePorts();
|
|
||||||
appendMessage(tr("Found %n free ports.", nullptr, m_portList.count()) + '\n', NormalMessageFormat);
|
|
||||||
reportStarted();
|
|
||||||
});
|
|
||||||
m_portsGatherer.start(device());
|
m_portsGatherer.start(device());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user