diff --git a/src/plugins/valgrind/valgrindtool.cpp b/src/plugins/valgrind/valgrindtool.cpp index 793313397e1..584a80cc95b 100644 --- a/src/plugins/valgrind/valgrindtool.cpp +++ b/src/plugins/valgrind/valgrindtool.cpp @@ -37,10 +37,11 @@ #include #include #include -#include #include +#include + using namespace ProjectExplorer; using namespace RemoteLinux; @@ -77,13 +78,10 @@ Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters( const ProjectExplorer::IDevice::ConstPtr device = ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit()); QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return sp); - Utils::TcpPortsGatherer portsGatherer; - portsGatherer.update(QAbstractSocket::UnknownNetworkLayerProtocol); - Utils::PortList portList = device->freePorts(); - int freePort = portsGatherer.getNextFreePort(&portList); - if (freePort == -1) + QTcpServer server; + if (!server.listen(QHostAddress(sp.connParams.host))) return sp; - sp.connParams.port = freePort; + sp.connParams.port = server.serverPort(); sp.startMode = Analyzer::StartLocal; } else if (RemoteLinuxRunConfiguration *rc2 = qobject_cast(runConfiguration)) {