From 98e20f64253da4895710f740601d4699cd1a2059 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 9 Sep 2013 13:52:37 +0200 Subject: [PATCH] Fix: Add missing locks. --- lib/icinga/host.cpp | 4 ++++ lib/icinga/service.cpp | 2 ++ lib/icinga/user.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index c9b4e7ea1..4ce3458ae 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -49,6 +49,8 @@ void Host::Start(void) Array::Ptr groups = GetGroups(); if (groups) { + ObjectLock olock(groups); + BOOST_FOREACH(const String& name, groups) { HostGroup::Ptr hg = HostGroup::GetByName(name); @@ -70,6 +72,8 @@ void Host::Stop(void) Array::Ptr groups = GetGroups(); if (groups) { + ObjectLock olock(groups); + BOOST_FOREACH(const String& name, groups) { HostGroup::Ptr hg = HostGroup::GetByName(name); diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index 61a65b55e..5a526d55e 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -58,6 +58,8 @@ void Service::OnConfigLoaded(void) Array::Ptr groups = GetGroups(); if (groups) { + ObjectLock olock(groups); + BOOST_FOREACH(const String& name, groups) { ServiceGroup::Ptr sg = ServiceGroup::GetByName(name); diff --git a/lib/icinga/user.cpp b/lib/icinga/user.cpp index 2cda97928..9245c8283 100644 --- a/lib/icinga/user.cpp +++ b/lib/icinga/user.cpp @@ -21,6 +21,7 @@ #include "icinga/usergroup.h" #include "base/dynamictype.h" #include "base/utility.h" +#include "base/objectlock.h" #include using namespace icinga; @@ -32,6 +33,8 @@ void User::OnConfigLoaded(void) Array::Ptr groups = GetGroups(); if (groups) { + ObjectLock olock(groups); + BOOST_FOREACH(const String& name, groups) { UserGroup::Ptr ug = UserGroup::GetByName(name); @@ -48,6 +51,8 @@ void User::Stop(void) Array::Ptr groups = GetGroups(); if (groups) { + ObjectLock olock(groups); + BOOST_FOREACH(const String& name, groups) { UserGroup::Ptr ug = UserGroup::GetByName(name); -- 2.40.0