summaryrefslogtreecommitdiff
path: root/sc/inc/recursionhelper.hxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-06-22 11:42:22 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-06-22 13:47:01 +0200
commite1b6dcc97d6b5ff15b2e9341d3943ffc05aa3236 (patch)
treebbdcc4672439c80d42b91f963f6c9da05129d479 /sc/inc/recursionhelper.hxx
parentbb4b538ff6c2b10d41784819224171df07910eaf (diff)
failed cell dependency check should not set invalid values (tdf#132451)
Calc's dependency check done before parallel formula cell group calculation tries to ensure valid cell values for all the dependencies of the group's cell, and if it detects a problem such as a cycle it bails out. But since ScFormulaCell::Interpret() simply bailed out without doing anything, other cells could use that cell's possibly incorrect value for their calculation and get their dirty flag reset. This fix adds a flag to mark that bailing out is in progress, which ensures the bail-out is short-circuited and no cell values are set. Change-Id: Ia93c70d456682e19ce533abd2cf65ce35ffed9ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96838 Reviewed-by: Dennis Francis <dennis.francis@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sc/inc/recursionhelper.hxx')
-rw-r--r--sc/inc/recursionhelper.hxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/sc/inc/recursionhelper.hxx b/sc/inc/recursionhelper.hxx
index 10c4ddc6f02e..48508ec61e64 100644
--- a/sc/inc/recursionhelper.hxx
+++ b/sc/inc/recursionhelper.hxx
@@ -63,6 +63,7 @@ class ScRecursionHelper
bool bInIterationReturn;
bool bConverging;
bool bGroupsIndependent;
+ bool bAbortingDependencyComputation;
std::vector< ScFormulaCell* > aTemporaryGroupCells;
o3tl::sorted_vector< ScFormulaCellGroup* >* pFGSet;
@@ -76,8 +77,8 @@ public:
void IncRecursionCount() { ++nRecursionCount; }
void DecRecursionCount() { --nRecursionCount; }
sal_uInt16 GetDepComputeLevel() const { return nDependencyComputationLevel; }
- void IncDepComputeLevel() { ++nDependencyComputationLevel; }
- void DecDepComputeLevel() { --nDependencyComputationLevel; }
+ void IncDepComputeLevel();
+ void DecDepComputeLevel();
/// A pure recursion return, no iteration.
bool IsInRecursionReturn() const { return bInRecursionReturn &&
!bInIterationReturn; }
@@ -115,6 +116,11 @@ public:
bool AnyCycleMemberInDependencyEvalMode(ScFormulaCell* pCell);
bool AnyParentFGInCycle();
void SetFormulaGroupDepEvalMode(bool bSet);
+ // When dependency computation detects a cycle, it may not compute proper cell values.
+ // This sets a flag that ScFormulaCell will use to avoid setting those new values
+ // and resetting the dirty flag, until the dependency computation bails out.
+ void AbortDependencyComputation();
+ bool IsAbortingDependencyComputation() const { return bAbortingDependencyComputation; }
void AddTemporaryGroupCell(ScFormulaCell* cell);
void CleanTemporaryGroupCells();