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);