From a22e79f38c13b652ad9639ee810647fc0c0e96b0 Mon Sep 17 00:00:00 2001 From: Andrii Semkiv Date: Wed, 23 Oct 2024 09:17:06 +0200 Subject: [PATCH] QML Profiler: Fix server URL QMLProfileRunner should use server URL from the ports gatherer instead of trying to read it from the data record. Amends: 94b63ad3b4b13dbad0277341f71c5d8f5ea1c6b2 Fixes: QTCREATORBUG-31847 Change-Id: Id54429f09cc10f17d763ede6db4df1fad8a323fe Reviewed-by: hjk --- src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp | 9 +-------- src/plugins/qmlprofiler/qmlprofilerruncontrol.h | 1 - src/plugins/qmlprofiler/qmlprofilertool.cpp | 5 +++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 3ab0647e810..42c1a550744 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -162,15 +162,9 @@ void QmlProfilerRunner::profilerStateChanged() } } -void QmlProfilerRunner::setServerUrl(const QUrl &serverUrl) -{ - recordData(QmlServerUrl, serverUrl); -} - QUrl QmlProfilerRunner::serverUrl() const { - QVariant recordedServer = recordedData(QmlServerUrl); - return recordedServer.toUrl(); + return runControl()->qmlChannel(); } // @@ -205,7 +199,6 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q setId("LocalQmlProfilerSupport"); auto profiler = new QmlProfilerRunner(runControl); - profiler->setServerUrl(serverUrl); addStopDependency(profiler); // We need to open the local server before the application tries to connect. diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h index fedc693b6e8..c59748c83d8 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h @@ -24,7 +24,6 @@ public: QmlProfilerRunner(ProjectExplorer::RunControl *runControl); ~QmlProfilerRunner() override; - void setServerUrl(const QUrl &serverUrl); QUrl serverUrl() const; void registerProfilerStateManager( QmlProfilerStateManager *profilerState ); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 7df40076f18..7b554b22cfa 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -603,8 +603,9 @@ ProjectExplorer::RunControl *QmlProfilerTool::attachToWaitingApplication() auto runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); runControl->copyDataFromRunConfiguration(ProjectManager::startupRunConfiguration()); - auto profiler = new QmlProfilerRunner(runControl); - profiler->setServerUrl(serverUrl); + // The object as such is needed, the RunWorker becomes part of the RunControl at construction time, + // similar to how QObject children are owned by their parents + [[maybe_unused]] auto profiler = new QmlProfilerRunner(runControl); connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionClosed, runControl, &RunControl::initiateStop);