Browse Source

Merge pull request #8135 from ghalliday/issue14762

HPCC-14762 Prevent scope cleanup from invalidating an active record

Reviewed-By: Jamie Noss <james.noss@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 years ago
parent
commit
91295be1f6
1 changed files with 7 additions and 1 deletions
  1. 7 1
      ecl/hql/hqlgram2.cpp

+ 7 - 1
ecl/hql/hqlgram2.cpp

@@ -2861,8 +2861,14 @@ void HqlGram::releaseScopes()
 
     leftRightScopes.kill();
     
-    while (selfScopes.length()>0)
+    while (selfScopes.length() > 0)
+    {
+        //Ensure that we do not remove any scopes that are still active - otherwise they will be released too early
+        OwnedHqlExpr self = getSelfScope();
+        if (activeRecords.contains(*self))
+            break;
         popSelfScope();
+    }
     modScope.clear();
     outerScopeAccessDepth = 0;