Fix: Add missing locks.

This commit is contained in:
Michael Friedrich 2013-09-09 13:52:37 +02:00
parent ec0a32380e
commit 98e20f6425
3 changed files with 11 additions and 0 deletions

View File

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

View File

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

View File

@ -21,6 +21,7 @@
#include "icinga/usergroup.h"
#include "base/dynamictype.h"
#include "base/utility.h"
#include "base/objectlock.h"
#include <boost/smart_ptr/make_shared.hpp>
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);