Commit f56363f0 authored by hjk's avatar hjk Committed by Tobias Hunger

ProjectExplorer: Avoid recently introduced crash when switching kits

LocalEnvironmentAspect needs to take care of being cloned.

Task-number: QTCREATORBUG-15700
Change-Id: Id040a2a150dbc1cd3e407aa3d7dfc2728d7bb3db
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent f41c6b0c
......@@ -73,7 +73,7 @@ Utils::Environment LocalEnvironmentAspect::baseEnvironment() const
}
if (m_baseEnvironmentModifier)
m_baseEnvironmentModifier(env);
m_baseEnvironmentModifier(runConfiguration(), env);
return env;
}
......
......@@ -35,7 +35,7 @@ class PROJECTEXPLORER_EXPORT LocalEnvironmentAspect : public EnvironmentAspect
Q_OBJECT
public:
typedef std::function<void(Utils::Environment &)> BaseEnvironmentModifier;
typedef std::function<void(RunConfiguration *, Utils::Environment &)> BaseEnvironmentModifier;
LocalEnvironmentAspect(RunConfiguration *parent, const BaseEnvironmentModifier &modifier);
LocalEnvironmentAspect *create(RunConfiguration *parent) const;
......
......@@ -112,7 +112,9 @@ QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) :
m_currentInstallStep(0),
m_currentBuildStepList(0)
{
addExtraAspect(new LocalEnvironmentAspect(this, [this](Environment &env) { addToBaseEnvironment(env); }));
addExtraAspect(new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) {
static_cast<QbsRunConfiguration *>(rc)->addToBaseEnvironment(env);
}));
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("Qbs.RunConfiguration.CommandLineArguments")));
addExtraAspect(new WorkingDirectoryAspect(this, QStringLiteral("Qbs.RunConfiguration.WorkingDirectory")));
......
......@@ -80,7 +80,9 @@ DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *parent, Core:
RunConfiguration(parent, id),
m_proFilePath(pathFromId(id))
{
addExtraAspect(new LocalEnvironmentAspect(this, [this](Environment &env) { addToBaseEnvironment(env); }));
addExtraAspect(new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) {
static_cast<DesktopQmakeRunConfiguration *>(rc)->addToBaseEnvironment(env);
}));
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments")));
addExtraAspect(new TerminalAspect(this, QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UseTerminal")));
addExtraAspect(new WorkingDirectoryAspect(this,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment