[icinga-checkins] icinga.org: icinga2/master: Added missing object locks in the MacroProcessor class.

git at icinga.org git at icinga.org
Thu Feb 28 10:27:47 CET 2013


Module: icinga2
Branch: master
Commit: 5300bf8473941135feb0ec530f96ece5f035592a
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=5300bf8473941135feb0ec530f96ece5f035592a

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Thu Feb 28 10:27:20 2013 +0100

Added missing object locks in the MacroProcessor class.

---

 lib/icinga/macroprocessor.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp
index 803fb21..5bc9a2a 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>();
 		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<Dictionary::Ptr>& d
 		if (!dict)
 			continue;
 
+		ObjectLock olock(dict);
+
 		String key;
 		Value value;
 		BOOST_FOREACH(tie(key, value), dict) {





More information about the icinga-checkins mailing list