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);