Fix crash in envmanager

To delete an entry, we need to ensure the KConfigGroup and none of its
parent config group is not const otherwise we it an assert in KConfig.
This commit is contained in:
Carl Schwan 2024-01-21 00:18:13 +01:00 committed by Devin Lin
parent e0a4614c25
commit d9330ad10d

View file

@ -136,8 +136,8 @@ void Settings::saveConfigSetting(const QString &fileName, const QString &group,
// NOTE: this deletes the stored value from the config after loading
const QString Settings::loadSavedConfigSetting(KSharedConfig::Ptr &config, const QString &fileName, const QString &group, const QString &key, bool write)
{
const auto savedGroup = KConfigGroup{m_mobileConfig, SAVED_CONFIG_GROUP};
const auto fileGroup = KConfigGroup{&savedGroup, fileName};
auto savedGroup = KConfigGroup{m_mobileConfig, SAVED_CONFIG_GROUP};
auto fileGroup = KConfigGroup{&savedGroup, fileName};
auto keyGroup = KConfigGroup{&fileGroup, group};
if (!keyGroup.hasKey(key)) {