summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2018-07-05 16:30:37 +0530
committerMichael Meeks <michael.meeks@collabora.com>2018-07-06 14:10:21 +0200
commit0f95580d392bb1a6f103f3a1543fb61a16f9f263 (patch)
treef54262fc55cae35e140ba6835b7652a88ad2efbf /sc
parent9ceeb4619ba762c47589023d99c43c774caab441 (diff)
Use cycle guard for calls to InterpretTail too
Some formula-groups even though a part of a cycle may get skipped from getting flagged(mbPartOfCycle) in the dependency calculator because it has other problems like self references. Such FG's can be caught when they through InterpretTail() by having a cycle guard there. Concretely it fixes a crash in the bugdoc of tdf#94271-2. Change-Id: I508df88804c7cd8dbbb6497188b1c9559bec3aa6 Reviewed-on: https://gerrit.libreoffice.org/57004 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/formulacell.cxx12
-rw-r--r--sc/source/core/tool/recursionhelper.cxx4
2 files changed, 11 insertions, 5 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 96aabc5ae07c..5c79b1780adb 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1540,14 +1540,18 @@ void ScFormulaCell::Interpret()
#if DEBUG_CALCULATION
aDC.enterGroup();
+#endif
+
bool bGroupInterpreted = InterpretFormulaGroup();
+
+#if DEBUG_CALCULATION
aDC.leaveGroup();
+#endif
if (!bGroupInterpreted)
+ {
+ ScFormulaGroupCycleCheckGuard aCycleCheckGuard(rRecursionHelper, mxGroup.get());
InterpretTail( pDocument->GetNonThreadedContext(), SCITP_NORMAL);
-#else
- if (!InterpretFormulaGroup())
- InterpretTail( pDocument->GetNonThreadedContext(), SCITP_NORMAL);
-#endif
+ }
pDocument->DecInterpretLevel();
}
diff --git a/sc/source/core/tool/recursionhelper.cxx b/sc/source/core/tool/recursionhelper.cxx
index 0c185dba3c6b..8cfef9776e35 100644
--- a/sc/source/core/tool/recursionhelper.cxx
+++ b/sc/source/core/tool/recursionhelper.cxx
@@ -98,7 +98,9 @@ void ScRecursionHelper::Clear()
bool ScRecursionHelper::PushFormulaGroup(ScFormulaCellGroup* pGrp)
{
- assert(pGrp);
+ if (!pGrp)
+ return false;
+
if (pGrp->mbSeenInPath)
{
// Found a simple cycle of formula-groups.