diff --git a/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp b/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp index 90b3dbd2b93..db1722043c3 100644 --- a/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp +++ b/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp @@ -348,7 +348,9 @@ GdbServerProviderRunner::GdbServerProviderRunner(ProjectExplorer::RunControl *ru { setId("BareMetalGdbServer"); // Baremetal's GDB servers are launched on the host, not on the target. - setStarter([this, runnable] { doStart(runnable, {}); }); + Runnable devicelessRunnable = runnable; + devicelessRunnable.device.reset(); + setStarter([this, devicelessRunnable] { doStart(devicelessRunnable); }); } } // namespace Internal diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp index b9b8aa237d7..bb2902dc68c 100644 --- a/src/plugins/boot2qt/qdbplugin.cpp +++ b/src/plugins/boot2qt/qdbplugin.cpp @@ -147,7 +147,8 @@ public: // FIXME: Spaces! r.command.setArguments(r.command.executable().toString() + ' ' + r.command.arguments()); r.command.setExecutable(FilePath::fromString(Constants::AppcontrollerFilepath)); - doStart(r, runControl->device()); + r.device = runControl->device(); + doStart(r); }); } }; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index ca638e41036..c6e7407bb18 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -1085,8 +1085,8 @@ DebugServerRunner::DebugServerRunner(RunControl *runControl, DebugServerPortsGat } } debugServer.command.setArguments(ProcessArgs::joinArgs(args, OsTypeLinux)); - - doStart(debugServer, runControl->device()); + debugServer.device = runControl->device(); + doStart(debugServer); }); } diff --git a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp index 361fb09b899..8894c501cfc 100644 --- a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp +++ b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp @@ -99,7 +99,7 @@ public: CommandLine::Raw}; r.workingDirectory = target->activeBuildConfiguration()->buildDirectory(); r.environment = target->activeBuildConfiguration()->environment(); - SimpleTargetRunner::doStart(r, {}); + SimpleTargetRunner::doStart(r); }); } }; diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index 7531269a945..ce1d0295746 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -1188,13 +1188,16 @@ SimpleTargetRunner::SimpleTargetRunner(RunControl *runControl) void SimpleTargetRunner::start() { - if (m_starter) + if (m_starter) { m_starter(); - else - doStart(runControl()->runnable(), runControl()->device()); + } else { + Runnable runnable = runControl()->runnable(); + runnable.device = runControl()->device(); + doStart(runControl()->runnable()); + } } -void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstPtr &device) +void SimpleTargetRunner::doStart(const Runnable &runnable) { m_stopForced = false; m_stopReported = false; @@ -1231,7 +1234,8 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP connect(&m_launcher, &ApplicationLauncher::appendMessage, this, &RunWorker::appendMessage); - const bool isDesktop = device.isNull() || device.dynamicCast(); + const bool isDesktop = runnable.device.isNull() + || runnable.device.dynamicCast(); if (isDesktop) { connect(&m_launcher, &ApplicationLauncher::processStarted, this, [this] { // Console processes only know their pid after being started @@ -1248,9 +1252,7 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP } else { connect(&m_launcher, &ApplicationLauncher::processStarted, this, &RunWorker::reportStarted); } - Runnable runnableWithDevice = runnable; - runnableWithDevice.device = device; - m_launcher.setRunnable(runnableWithDevice); + m_launcher.setRunnable(runnable); m_launcher.start(); } diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h index db70939e3a8..7a6ca088478 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -294,7 +294,7 @@ public: protected: void setStarter(const std::function &starter); - void doStart(const Runnable &runnable, const IDevice::ConstPtr &device); + void doStart(const Runnable &runnable); private: void start() final; diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index 1af9f8bb793..22c9db93cb2 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -149,7 +149,8 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC runnable.command.addArg(QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlPreviewServices, serverUrl.path())); - doStart(runnable, {}); + runnable.device.reset(); + doStart(runnable); }); } diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 9eaf06fee4b..06822865ef4 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -255,8 +255,8 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q arguments += ' ' + debuggee.command.arguments(); debuggee.command.setArguments(arguments); - - doStart(debuggee, {}); + debuggee.device.reset(); + doStart(debuggee); }); } diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index a7bfd50cffe..6cf073c3504 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -62,8 +62,8 @@ QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl) Runnable r = runControl->runnable(); r.command.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl)); - - doStart(r, runControl->device()); + r.device = runControl->device(); + doStart(r); }); } diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index c345d76506e..895113488e9 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -116,8 +116,8 @@ public: portsGatherer->qmlServer())); } r.command.setArguments(ProcessArgs::joinArgs(arguments)); - - doStart(r, runControl->device()); + r.device = runControl->device(); + doStart(r); }); } }; @@ -202,7 +202,8 @@ public: Runnable r; r.command = {QNX_DEBUG_EXECUTABLE, {QString::number(pdebugPort)}}; - doStart(r, runControl->device()); + r.device = runControl->device(); + doStart(r); }); } }; diff --git a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp index 674371278f6..7b732e15490 100644 --- a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp @@ -59,8 +59,8 @@ RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(RunControl *runContro Runnable r = runControl->runnable(); r.command.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl)); - - doStart(r, runControl->device()); + r.device = runControl->device(); + doStart(r); }); } diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.cpp b/src/plugins/webassembly/webassemblyrunconfiguration.cpp index f06da53c093..54f6d5cb47e 100644 --- a/src/plugins/webassembly/webassemblyrunconfiguration.cpp +++ b/src/plugins/webassembly/webassemblyrunconfiguration.cpp @@ -124,7 +124,7 @@ public: r.command = emrunCommand(runControl->runConfiguration(), browserId, QString::number(portsGatherer->findEndPoint().port())); - SimpleTargetRunner::doStart(r, {}); + SimpleTargetRunner::doStart(r); }); } };