From dbd812e641285e093b86fd5e6de2c58f804b665e Mon Sep 17 00:00:00 2001 From: Filipe Azevedo Date: Fri, 20 Oct 2017 14:55:19 +0200 Subject: [PATCH] Fix multiple connections on runner restarted Change-Id: I5ea243d9f5d2266500378381b78c0b2610261f14 Reviewed-by: hjk --- .../devicesupport/deviceusedportsgatherer.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp index f7c85ce0c7a..a8590977387 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp +++ b/src/plugins/projectexplorer/devicesupport/deviceusedportsgatherer.cpp @@ -177,6 +177,13 @@ PortsGatherer::PortsGatherer(RunControl *runControl) : RunWorker(runControl) { 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() @@ -185,15 +192,7 @@ PortsGatherer::~PortsGatherer() void PortsGatherer::start() { - appendMessage(tr("Checking available ports...") + '\n', 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(); - }); + appendMessage(tr("Checking available ports..."), NormalMessageFormat); m_portsGatherer.start(device()); }