]> granicus.if.org Git - icinga2/commitdiff
Fix deadlock when calling functions recursively.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 9 May 2014 12:45:59 +0000 (14:45 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 9 May 2014 12:45:59 +0000 (14:45 +0200)
Fixes #6178

lib/config/aexpression.cpp

index 523c039c579e6496ae2de64d4c45c8f03cec2e79..01d19b17bfcb5445c41d6bdadd430e6c9b5f4cba 100644 (file)
@@ -263,8 +263,9 @@ Value AExpression::OpFunctionCall(const AExpression *expr, const Dictionary::Ptr
 
        Array::Ptr arr = expr->EvaluateOperand2(locals);
        std::vector<Value> arguments;
-       ObjectLock olock(arr);
-       BOOST_FOREACH(const AExpression::Ptr& aexpr, arr) {
+       int index = 0;
+       for (int index = 0; index < arr->GetLength(); index++) {
+               const AExpression::Ptr& aexpr = arr->Get(index);
                arguments.push_back(aexpr->Evaluate(locals));
        }
 
@@ -277,8 +278,9 @@ Value AExpression::OpArray(const AExpression *expr, const Dictionary::Ptr& local
        Array::Ptr result = make_shared<Array>();
 
        if (arr) {
-               ObjectLock olock(arr);
-               BOOST_FOREACH(const AExpression::Ptr& aexpr, arr) {
+               int index = 0;
+               for (int index = 0; index < arr->GetLength(); index++) {
+                       const AExpression::Ptr& aexpr = arr->Get(index);
                        result->Add(aexpr->Evaluate(locals));
                }
        }
@@ -295,8 +297,9 @@ Value AExpression::OpDict(const AExpression *expr, const Dictionary::Ptr& locals
        result->Set("__parent", locals);
 
        if (arr) {
-               ObjectLock olock(arr);
-               BOOST_FOREACH(const AExpression::Ptr& aexpr, arr) {
+               int index = 0;
+               for (int index = 0; index < arr->GetLength(); index++) {
+                       const AExpression::Ptr& aexpr = arr->Get(index);
                        Dictionary::Ptr alocals = in_place ? locals : result;
                        aexpr->Evaluate(alocals);