|author||Luboš Luňák <email@example.com>||2019-01-25 15:08:16 +0100|
|committer||Luboš Luňák <firstname.lastname@example.org>||2019-01-28 11:01:06 +0100|
avoid a calc threads assert because of an undetected cyclic dependency
ooo#103156-1 has a quite complex cycle of cells, some of them (and only some) in formula groups. And the complex Interpret() nesting confuses its cycle detection into believing that Interpret() can simply return without providing a value, which is ok if it's called from dependency checking of threaded calculation, but is not ok when it's called for a single cell evalution. So make the code set cyclic-dependency error even when it's possibly inside dependency checking, since if it's really that case, the error will be later overwritten by the actual value. This is still not a completely correct fix, as the document on repeated hard recals alternates some cells between correctly reporting an error and providing some bogus values (e.g. column S in the second sheet). But the document uses iteration, which complicates all this stuff even more, and after spending quite some time on this I'm still not sure on how to fix that. So at least for now, at least avoid the assert. Change-Id: I395f97d104d98b5c043d1f17878338d3f1b31146 Reviewed-on: https://gerrit.libreoffice.org/66911 Tested-by: Jenkins Reviewed-by: Dennis Francis <email@example.com> Reviewed-by: Luboš Luňák <firstname.lastname@example.org>
1 files changed, 2 insertions, 1 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 900bd2e71990..3137cfd53a42 100644
@@ -1519,9 +1519,10 @@ void ScFormulaCell::Interpret()
ScFormulaCell* pTopCell = mxGroup ? mxGroup->mpTopCell : this;
- if (pTopCell->mbSeenInPath && rRecursionHelper.GetDepComputeLevel() && !bRunning)
+ if (pTopCell->mbSeenInPath && rRecursionHelper.GetDepComputeLevel())
// This call arose from a dependency calculation and we just found a cycle.
+ aResult.SetResultError( FormulaError::CircularReference );
// This will mark all elements in the cycle as parts-of-cycle.
ScFormulaGroupCycleCheckGuard aCycleCheckGuard(rRecursionHelper, pTopCell);