ProjectExplorer: Fix assert

The build key is legitimately empty for CustomExecutableRunConfig.

Amends 07df45cdeb.

Change-Id: Iadc992b772913599e5af0d5ea5104188707fad45
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2024-08-02 09:14:04 +02:00
parent 2a7bf0fdaf
commit 00daa669ad
5 changed files with 19 additions and 2 deletions

View File

@@ -66,6 +66,7 @@ public:
setDefaultDisplayName(RunConfigurationFactory::decoratedTargetName(
Tr::tr("Custom Executable"), target));
setUsesEmptyBuildKeys();
}
public:

View File

@@ -42,6 +42,7 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *targe
});
setDefaultDisplayName(defaultDisplayName());
setUsesEmptyBuildKeys();
}
bool CustomExecutableRunConfiguration::isEnabled(Id) const

View File

@@ -311,7 +311,13 @@ void RunConfiguration::toMap(Store &map) const
void RunConfiguration::toMapSimple(Store &map) const
{
ProjectConfiguration::toMap(map);
if (m_usesEmptyBuildKeys) {
QTC_CHECK(m_buildKey.isEmpty());
} else {
QTC_CHECK(!m_buildKey.isEmpty());
}
map.insert(BUILD_KEY, m_buildKey);
}
@@ -372,7 +378,12 @@ void RunConfiguration::fromMap(const Store &map)
m_customized = m_customized || map.value(CUSTOMIZED_KEY, false).toBool();
m_buildKey = map.value(BUILD_KEY).toString();
if (m_usesEmptyBuildKeys) {
QTC_CHECK(m_buildKey.isEmpty());
} else {
QTC_CHECK(!m_buildKey.isEmpty());
}
}
/*!

View File

@@ -185,6 +185,8 @@ protected:
Task createConfigurationIssue(const QString &description) const;
void setUsesEmptyBuildKeys() { m_usesEmptyBuildKeys = true; }
private:
// Any additional data should be handled by aspects.
void fromMap(const Utils::Store &map) final;
@@ -204,6 +206,7 @@ private:
Utils::MacroExpander m_expander;
Utils::Store m_pristineState;
bool m_customized = false;
bool m_usesEmptyBuildKeys = false;
};
class RunConfigurationCreationInfo

View File

@@ -61,6 +61,7 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar
x11Forwarding.setMacroExpander(macroExpander());
setDefaultDisplayName(runConfigDefaultDisplayName());
setUsesEmptyBuildKeys();
}
QString RemoteLinuxCustomRunConfiguration::runConfigDefaultDisplayName()