From f6c276daf03c59326bdf1fec3a44c48307912fae Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 27 Feb 2019 14:34:18 +0100 Subject: [PATCH] Macro expander: Do not use RunConfiguration::runnable() ... to get the current executable. That leads to an infinite loop if the argument or working directory fields reference the %{CurrentRun:Executable:Path} variable, as these fields also get evaluated in RunConfiguration::runnable(). Fixes: QTCREATORBUG-18317 Change-Id: Ic249f8ff78d170110947e370045144817b179341 Reviewed-by: hjk --- src/plugins/projectexplorer/projectexplorer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 4b700e89a21..eebd7c91ed1 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -44,6 +44,7 @@ #include "projectexplorersettingspage.h" #include "projectmanager.h" #include "removetaskhandler.h" +#include "runconfigurationaspects.h" #include "kitfeatureprovider.h" #include "kitmanager.h" #include "kitoptionspage.h" @@ -1586,8 +1587,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er tr("The currently active run configuration's executable (if applicable)."), []() -> QString { if (Target *target = activeTarget()) { - if (RunConfiguration *rc = target->activeRunConfiguration()) - return rc->runnable().executable; + if (RunConfiguration *rc = target->activeRunConfiguration()) { + // TODO: This duplicates code and is not always correct, but see + // QTCREATORBUG-18317. + // Solution: Re-introduce RunConfiguration::executable()? + if (auto executableAspect = rc->aspect()) + return executableAspect->executable().toString(); + return QString(); + } } return QString(); });