diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index c0cff2369cc..8139596fab7 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -38,7 +38,6 @@ QmlProfilerRunner::QmlProfilerRunner(RunControl *runControl) : RunWorker(runControl) { setId("QmlProfilerRunner"); - runControl->requestQmlChannel(); runControl->setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR); } @@ -152,6 +151,7 @@ RunWorker *createLocalQmlProfilerWorker(RunControl *runControl) worker->setId("LocalQmlProfilerSupport"); auto profiler = new QmlProfilerRunner(runControl); + runControl->requestQmlChannel(); worker->addStopDependency(profiler); // We need to open the local server before the application tries to connect. diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index cc456bc448f..e576a0a18c2 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -555,7 +555,9 @@ ProjectExplorer::RunControl *QmlProfilerTool::attachToWaitingApplication() d->m_viewContainer->perspective()->select(); auto runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); - runControl->copyDataFromRunConfiguration(activeRunConfigForActiveProject()); + if (RunConfiguration *runConfig = activeRunConfigForActiveProject()) + runControl->copyDataFromRunConfiguration(runConfig); + runControl->setQmlChannel(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);