Commit 2df014f5 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

ConfigMonitor: Properly combine erase and iteration

Otherwise we skip the item right after the removed element
parent 2c1e09a9
...@@ -184,10 +184,12 @@ void ConfigMonitor::Private::updateConfigs(const KScreen::ConfigPtr &newConfig) ...@@ -184,10 +184,12 @@ void ConfigMonitor::Private::updateConfigs(const KScreen::ConfigPtr &newConfig)
void ConfigMonitor::Private::configDestroyed(QObject *removedConfig) void ConfigMonitor::Private::configDestroyed(QObject *removedConfig)
{ {
for (auto iter = watchedConfigs.begin(); iter != watchedConfigs.end(); ++iter) { for (auto iter = watchedConfigs.begin(); iter != watchedConfigs.end(); ) {
if (iter->toStrongRef() == removedConfig) { if (iter->toStrongRef() == removedConfig) {
iter = watchedConfigs.erase(iter); iter = watchedConfigs.erase(iter);
// Iterate over the entire list in case there are duplicates // Iterate over the entire list in case there are duplicates
} else {
++iter;
} }
} }
} }
......
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