[Libreoffice-commits] core.git: sc/source

Dennis Francis dennis.francis at collabora.co.uk
Fri Jul 6 12:10:49 UTC 2018


 sc/source/core/data/formulacell.cxx     |   12 ++++++++----
 sc/source/core/tool/recursionhelper.cxx |    4 +++-
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 0f95580d392bb1a6f103f3a1543fb61a16f9f263
Author: Dennis Francis <dennis.francis at collabora.co.uk>
Date:   Thu Jul 5 16:30:37 2018 +0530

    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 at collabora.com>

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.


More information about the Libreoffice-commits mailing list