]> granicus.if.org Git - icinga2/commitdiff
Fix deadlock in Service::RemoveAllComments().
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 7 Mar 2014 08:53:21 +0000 (09:53 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 7 Mar 2014 08:53:47 +0000 (09:53 +0100)
Fixes #5721

lib/icinga/service-comment.cpp

index 7a9ae1330675d169d8b0dae38fe0df57eb6d713c..f16faa4adece01b869c86ea6fc9874f75398bc41 100644 (file)
@@ -88,9 +88,11 @@ void Service::RemoveAllComments(void)
        std::vector<String> ids;
        Dictionary::Ptr comments = GetComments();
 
-       ObjectLock olock(comments);
-       BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
-               ids.push_back(kv.first);
+       {
+               ObjectLock olock(comments);
+               BOOST_FOREACH(const Dictionary::Pair& kv, comments) {
+                       ids.push_back(kv.first);
+               }
        }
 
        BOOST_FOREACH(const String& id, ids) {