diff --git a/lib/icingadb/icingadb-utility.cpp b/lib/icingadb/icingadb-utility.cpp index f82625019..bb24e0314 100644 --- a/lib/icingadb/icingadb-utility.cpp +++ b/lib/icingadb/icingadb-utility.cpp @@ -266,14 +266,23 @@ std::vector IcingaDB::GetArrayDeletedValues(const Array::Ptr& arrayOld, c } if (!arrayNew) { + ObjectLock olock (arrayOld); return std::vector(arrayOld->Begin(), arrayOld->End()); } - std::vector vectorOld(arrayOld->Begin(), arrayOld->End()); + std::vector vectorOld; + { + ObjectLock olock (arrayOld); + vectorOld.assign(arrayOld->Begin(), arrayOld->End()); + } std::sort(vectorOld.begin(), vectorOld.end()); vectorOld.erase(std::unique(vectorOld.begin(), vectorOld.end()), vectorOld.end()); - std::vector vectorNew(arrayNew->Begin(), arrayNew->End()); + std::vector vectorNew; + { + ObjectLock olock (arrayNew); + vectorNew.assign(arrayNew->Begin(), arrayNew->End()); + } std::sort(vectorNew.begin(), vectorNew.end()); vectorNew.erase(std::unique(vectorNew.begin(), vectorNew.end()), vectorNew.end());