[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/inc

Eike Rathke (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 15 14:13:19 UTC 2021


 sc/inc/formulacell.hxx |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit 4b3b1f01178f4ab079fd2d2c71dcf10753dc2680
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Apr 1 23:51:46 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 15 16:12:45 2021 +0200

    Work around assert() in circular reference within group calc, tdf#141146
    
    Triggered by crash test loading document of
    wget 'https://bz.apache.org/ooo/attachment.cgi?id=71756' -O ooo114587-1.ods
    
    after
    
        commit 042dbf83122b14fd1dd32705c8f8b7d65c22f21b
        CommitDate: Thu Mar 25 16:31:29 2021 +0100
    
            Resolves: tdf#141146 Fix LOOKUP in array with result
            scalar / single reference
    
    Though could happen any time whenever a shared formula group calc
    attempts to obtain a result from an already running cell.
    
    Change-Id: Id668b31a8d81389c593c6fd2191fd444efcdb70f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113494
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 465b8b0e9ad4b0c9c7701dee2820a99c5d00b5bf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113633
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 9be8b84df8a9..a6701bcbf0bd 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -23,11 +23,13 @@
 #include <memory>
 
 #include <formula/tokenarray.hxx>
+#include <formula/errorcodes.hxx>
 #include <svl/listener.hxx>
 
 #include "types.hxx"
 #include "interpretercontext.hxx"
 #include "document.hxx"
+#include "docoptio.hxx"
 #include "formulalogger.hxx"
 #include "formularesult.hxx"
 
@@ -437,15 +439,25 @@ public:
         return (rDocument.GetAutoCalc() || (cMatrixFlag != ScMatrixMode::NONE));
     }
 
-    bool MaybeInterpret()
+    void MaybeInterpret()
     {
         if (NeedsInterpret())
         {
-            assert(!rDocument.IsThreadedGroupCalcInProgress());
-            Interpret();
-            return true;
+            if (bRunning && !rDocument.GetDocOptions().IsIter() && rDocument.IsThreadedGroupCalcInProgress())
+            {
+                // This is actually copied from Interpret()'s if(bRunning)
+                // block that once caught this circular reference but now is
+                // prepended with various threaded group calc things which the
+                // assert() below is supposed to fail on when entering again.
+                // Nevertheless, we need some state here the caller can obtain.
+                aResult.SetResultError( FormulaError::CircularReference );
+            }
+            else
+            {
+                assert(!rDocument.IsThreadedGroupCalcInProgress());
+                Interpret();
+            }
         }
-        return false;
     }
 
     /**


More information about the Libreoffice-commits mailing list