aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2021-10-11 15:46:11 +0200
committerhjk <hjk@qt.io>2021-10-12 10:51:12 +0000
commit2292e3a7a6ebc245ac76cf3ae37e7936c77ff939 (patch)
treeb4f18610fbb97097140749865241fd348921ad6c
parent3ccf269f81eb7d26af1962915026ae9ce4b6d5f8 (diff)
ProjectExplorer: Always set a RunControl's macro expander
In some cases (e.g. "Attach to running application") there is no proper RunConfiguration, so fall back to Target or Kit. Amends e78f456083a87 Change-Id: I0093d5f573fc259fd2a72bbc1aaa22dcb8adbaee Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/projectexplorer/runcontrol.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp
index 4cd0665f09..9ca0e228c3 100644
--- a/src/plugins/projectexplorer/runcontrol.cpp
+++ b/src/plugins/projectexplorer/runcontrol.cpp
@@ -349,7 +349,7 @@ public:
IDevice::ConstPtr device;
Utils::Id runMode;
Utils::Icon icon;
- const MacroExpander *macroExpander;
+ const MacroExpander *macroExpander = nullptr;
QPointer<RunConfiguration> runConfiguration; // Not owned. Avoid use.
QString buildKey;
QMap<Utils::Id, QVariantMap> settingsData;
@@ -389,11 +389,12 @@ void RunControl::setRunConfiguration(RunConfiguration *runConfig)
d->runConfigId = runConfig->id();
d->runnable = runConfig->runnable();
d->displayName = runConfig->expandedDisplayName();
- d->macroExpander = runConfig->macroExpander();
d->buildKey = runConfig->buildKey();
d->settingsData = runConfig->aspectData();
setTarget(runConfig->target());
+
+ d->macroExpander = runConfig->macroExpander();
}
void RunControl::setTarget(Target *target)
@@ -412,6 +413,7 @@ void RunControl::setTarget(Target *target)
}
setKit(target->kit());
+ d->macroExpander = target->macroExpander();
d->project = target->project();
}
@@ -420,6 +422,7 @@ void RunControl::setKit(Kit *kit)
QTC_ASSERT(kit, return);
QTC_CHECK(!d->kit);
d->kit = kit;
+ d->macroExpander = kit->macroExpander();
if (d->runnable.device)
setDevice(d->runnable.device);