From 3d7c103035ea918d49e8250fd59115dae81068a9 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 9 Dec 2013 13:22:50 +0100 Subject: [PATCH] Fix deadlock in ServiceDbConnect::Add{Comments,Downtimes}. Fixes #5286 --- lib/db_ido/servicedbobject.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index b9a5cd7d5..4b32938b8 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -325,11 +325,11 @@ void ServiceDbObject::AddComments(const Service::Ptr& service) /* dump all comments */ Dictionary::Ptr comments = service->GetComments(); - ObjectLock olock(comments); - if (comments->GetLength() > 0) RemoveComments(service); + ObjectLock olock(comments); + BOOST_FOREACH(const Dictionary::Pair& kv, comments) { AddComment(service, kv.second); } @@ -490,11 +490,11 @@ void ServiceDbObject::AddDowntimes(const Service::Ptr& service) /* dump all downtimes */ Dictionary::Ptr downtimes = service->GetDowntimes(); - ObjectLock olock(downtimes); - if (downtimes->GetLength() > 0) RemoveDowntimes(service); + ObjectLock olock(downtimes); + BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) { AddDowntime(service, kv.second); } -- 2.40.0