From c4edecc1fbe585981348a41932d18771c0dce884 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Tue, 6 Aug 2024 16:14:14 +0200 Subject: [PATCH] Unregister invalid config objects properly --- lib/config/configitem.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index f54b90c95..bf4da81a4 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -472,13 +472,16 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue continue; std::atomic committed_items(0); - std::mutex newItemsMutex; { auto items (itemsByType.find(type.get())); if (items != itemsByType.end()) { - upq.ParallelFor(items->second, [&committed_items, &newItems, &newItemsMutex](const ItemPair& ip) { + for (const ItemPair& pair: items->second) { + newItems.emplace_back(pair.first); + } + + upq.ParallelFor(items->second, [&committed_items](const ItemPair& ip) { const ConfigItem::Ptr& item = ip.first; if (!item->Commit(ip.second)) { @@ -490,9 +493,6 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue } committed_items++; - - std::unique_lock lock(newItemsMutex); - newItems.emplace_back(item); }); upq.Join();