diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index 4ff5d328425..68f90c401b2 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -47,11 +47,11 @@ #include #include #include -#include #include #include #include +#include using namespace Analyzer; using namespace ProjectExplorer; @@ -121,13 +121,10 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo const ProjectExplorer::IDevice::ConstPtr device = ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit()); QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0); - 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(QLatin1String("127.0.0.1")))) return 0; - conf.port = freePort; + conf.port = server.serverPort(); runner = new LocalQmlProfilerRunner(conf, parent); } return runner; diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index b50fb1f857a..5f11694d577 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -85,6 +84,7 @@ #include #include #include +#include using namespace Core; using namespace Core::Constants; @@ -343,13 +343,10 @@ AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration const ProjectExplorer::IDevice::ConstPtr device = ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit()); if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { - 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 = StartQml; return sp;