outputconfigurationstore: invalidate duplicate output entries
The configuration file may contain entries that have the same output identifiers if there's a bug in the implementation. To repair the config, this commit checks for duplicate entries in the output list and removes them when loading the config file.
This commit is contained in:
parent
0a844c2bde
commit
fde1393076
1 changed files with 12 additions and 0 deletions
|
@ -555,6 +555,18 @@ void OutputConfigurationStore::load()
|
|||
// without an identifier the settings are useless
|
||||
// we still have to push something into the list so that the indices stay correct
|
||||
outputDatas.push_back(std::nullopt);
|
||||
qCWarning(KWIN_CORE, "Output in config is missing identifiers");
|
||||
continue;
|
||||
}
|
||||
const bool hasDuplicate = std::any_of(outputDatas.begin(), outputDatas.end(), [&state](const auto &data) {
|
||||
return data
|
||||
&& data->edidIdentifier == state.edidIdentifier
|
||||
&& data->mstPath == state.mstPath
|
||||
&& data->connectorName == state.connectorName;
|
||||
});
|
||||
if (hasDuplicate) {
|
||||
qCWarning(KWIN_CORE, "Duplicate output found in config");
|
||||
outputDatas.push_back(std::nullopt);
|
||||
continue;
|
||||
}
|
||||
if (const auto it = data.find("mode"); it != data.end()) {
|
||||
|
|
Loading…
Reference in a new issue