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

Kohei Yoshida kohei.yoshida at collabora.com
Sat Nov 12 04:34:22 UTC 2016


 sc/source/core/data/formulacell.cxx |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

New commits:
commit 545f5f8abd1df1f9818fbc62c95006149bcc18ef
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Nov 11 21:17:01 2016 -0500

    Guarantee that InterpretFormulaGroup() is always called first.
    
    This makes it easier to profile group calculations via formula log.
    You can always bail out of that function when unfavorable condition
    hits.
    
    Change-Id: I49664c3e34b9efc98f39845379631649f76769de
    Reviewed-on: https://gerrit.libreoffice.org/30790
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 6231bc6..8b2e62a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1537,24 +1537,16 @@ void ScFormulaCell::Interpret()
     }
     else
     {
-        // Do not attempt to interpret a group when calculations are already
-        // running, otherwise we may run into a circular reference hell. See
-        // tdf#95748
-        if (rRecursionHelper.GetRecursionCount())
-            InterpretTail( SCITP_NORMAL);
-        else
-        {
 #if DEBUG_CALCULATION
-            aDC.enterGroup();
-            bool bGroupInterpreted = InterpretFormulaGroup();
-            aDC.leaveGroup();
-            if (!bGroupInterpreted)
-                InterpretTail( SCITP_NORMAL);
+        aDC.enterGroup();
+        bool bGroupInterpreted = InterpretFormulaGroup();
+        aDC.leaveGroup();
+        if (!bGroupInterpreted)
+            InterpretTail( SCITP_NORMAL);
 #else
-            if (!InterpretFormulaGroup())
-                InterpretTail( SCITP_NORMAL);
+        if (!InterpretFormulaGroup())
+            InterpretTail( SCITP_NORMAL);
 #endif
-        }
     }
 
     // While leaving a recursion or iteration stack, insert its cells to the
@@ -4033,6 +4025,15 @@ bool ScFormulaCell::InterpretFormulaGroup()
 
     auto aScope = sc::FormulaLogger::get().enterGroup(*pDocument, *this);
 
+    if (pDocument->GetRecursionHelper().GetRecursionCount())
+    {
+        // Do not attempt to interpret a group when calculations are already
+        // running, otherwise we may run into a circular reference hell. See
+        // tdf#95748
+        aScope.addMessage("group calc disabled during recursive calculation.");
+        return false;
+    }
+
     if (mxGroup->meCalcState == sc::GroupCalcDisabled)
     {
         aScope.addMessage("group calc disabled");


More information about the Libreoffice-commits mailing list