diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp index 803fb21b6..5bc9a2a1a 100644 --- a/lib/icinga/macroprocessor.cpp +++ b/lib/icinga/macroprocessor.cpp @@ -31,6 +31,8 @@ Value MacroProcessor::ResolveMacros(const Value& cmd, const Dictionary::Ptr& mac Dictionary::Ptr resultDict = boost::make_shared(); Dictionary::Ptr dict = cmd; + ObjectLock olock(dict); + Value arg; BOOST_FOREACH(tie(tuples::ignore, arg), dict) { resultDict->Add(InternalResolveMacros(arg, macros)); @@ -46,8 +48,9 @@ Value MacroProcessor::ResolveMacros(const Value& cmd, const Dictionary::Ptr& mac String MacroProcessor::InternalResolveMacros(const String& str, const Dictionary::Ptr& macros) { - size_t offset, pos_first, pos_second; + ObjectLock olock(macros); + size_t offset, pos_first, pos_second; offset = 0; String result = str; @@ -78,6 +81,8 @@ Dictionary::Ptr MacroProcessor::MergeMacroDicts(const vector& d if (!dict) continue; + ObjectLock olock(dict); + String key; Value value; BOOST_FOREACH(tie(key, value), dict) {