[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 16 13:45:03 UTC 2020


 sc/source/core/data/column4.cxx |   28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 2cfa9c036cdf69aef87586f1e13d6c62771d6564
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Sep 4 15:51:07 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Sep 16 15:44:27 2020 +0200

    detect if a cell still needs interpreting after Interpret()
    
    https://bugs.documentfoundation.org/attachment.cgi?id=51878
    after hard-recalc asserts because of not having cell dependencies
    non-dirty for threaded calculation. This is because Interpret()
    actually sometimes returns without computing a value for the cell,
    e.g. when it backs out because of a need to do iteration.
    This is handled when Interpret() is called from InterpretTail(),
    but ScDependantsCalculator does not handle this and considers
    all cells interpreted, unless it detected a problem.
    We've already fixed a number of such bugs, and given that there
    are still problematic corner cases after all this time, add code
    simply detecting this generic problem and avoiding threading
    in that case, with a SAL_WARN. This does not fix the problem
    itself, but at least now it's handled.
    
    Change-Id: I2f454b577f6516d2ce008005dbfbeb554e18d811
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102156
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 4f36f2ccab6286ec09480caea602c0fa19195736)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102308
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 06f4684a5acd..73adaf72dd71 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1667,6 +1667,10 @@ static bool lcl_InterpretSpan(sc::formula_block::const_iterator& rSpanIter, SCRO
             // Found a completely dirty sub span [nSpanStart, nSpanEnd] inside the required span [nStartOffset, nEndOffset]
             bool bGroupInterpreted = pCellStart->Interpret(nSpanStart, nSpanEnd);
 
+            if (bGroupInterpreted)
+                for (SCROW nIdx = nSpanStart; nIdx <= nSpanEnd; ++nIdx, ++itSpanStart)
+                    assert(!(*itSpanStart)->NeedsInterpret());
+
             ScRecursionHelper& rRecursionHelper = rDoc.GetRecursionHelper();
             // child cell's Interpret could result in calling dependency calc
             // and that could detect a cycle involving mxGroup
@@ -1686,7 +1690,15 @@ static bool lcl_InterpretSpan(sc::formula_block::const_iterator& rSpanIter, SCRO
                 ++itSpanStart;
                 for (SCROW nIdx = nSpanStart+1; nIdx <= nSpanEnd; ++nIdx, ++itSpanStart)
                 {
-                    (*itSpanStart)->Interpret(); // We know for sure that this cell is dirty so directly call Interpret().
+                    if( !(*itSpanStart)->Interpret()) // We know for sure that this cell is dirty so directly call Interpret().
+                    {
+                        SAL_WARN("sc.core.formulagroup", "Internal error, cell " << (*itSpanStart)->aPos
+                            << " failed running Interpret(), not allowing threading");
+                        bAllowThreading = false;
+                        return bAnyDirty;
+                    }
+                    assert(!(*itSpanStart)->NeedsInterpret());
+
                     // Allow early exit like above.
                     if ((mxParentGroup && mxParentGroup->mbPartOfCycle) || !rRecursionHelper.AreGroupsIndependent())
                     {
@@ -1788,7 +1800,19 @@ static void lcl_EvalDirty(sc::CellStoreType& rCells, SCROW nRow1, SCROW nRow2, S
                     else
                     {
                         // No formula-group here.
-                        bool bDirtyFlag = (*itCell)->MaybeInterpret();
+                        bool bDirtyFlag = false;
+                        if( (*itCell)->NeedsInterpret())
+                        {
+                            bDirtyFlag = true;
+                            if(!(*itCell)->Interpret())
+                            {
+                                SAL_WARN("sc.core.formulagroup", "Internal error, cell " << (*itCell)->aPos
+                                    << " failed running Interpret(), not allowing threading");
+                                bAllowThreading = false;
+                                return;
+                            }
+                            assert(!(*itCell)->NeedsInterpret());
+                        }
                         bIsDirty = bIsDirty || bDirtyFlag;
 
                         // child cell's Interpret could result in calling dependency calc


More information about the Libreoffice-commits mailing list