From 68b1b828e6030b4fe26ca9ffc4ee7a0b4bfe8f4e Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Thu, 14 May 2009 14:30:08 +0200
Subject: [PATCH] fix m_invertNext effect scoping

an evaluation function can be an include statement. the included code
must neither inherit nor change the current inversion state.
---
 src/shared/proparser/profileevaluator.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp
index 453fe88bd01..8a3b1edfe28 100644
--- a/src/shared/proparser/profileevaluator.cpp
+++ b/src/shared/proparser/profileevaluator.cpp
@@ -869,6 +869,9 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
 
 bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
 {
+    // Make sure that called subblocks don't inherit & destroy the state
+    bool invertThis = m_invertNext;
+    m_invertNext = false;
     if (!m_sts.updateCondition || m_sts.condition == ConditionFalse) {
         QString text = func->text();
         int lparen = text.indexOf(QLatin1Char('('));
@@ -878,10 +881,9 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
         QString funcName = text.left(lparen);
         m_lineNo = func->lineNumber();
         bool result = evaluateConditionalFunction(funcName.trimmed(), arguments);
-        if (!m_skipLevel && (result ^ m_invertNext))
+        if (!m_skipLevel && (result ^ invertThis))
             m_sts.condition = ConditionTrue;
     }
-    m_invertNext = false;
     return true;
 }
 
-- 
GitLab