sc/source/core/data/formulacell.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 906b505940f6330d2336164f341e338ff4b9b9ee
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Fri Jan 25 15:08:16 2019 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Mon Jan 28 11:01:06 2019 +0100

    avoid a calc threads assert because of an undetected cyclic dependency
    
    ooo#103156-1 has a quite complex cycle of cells, some of them (and only 
some)
    in formula groups. And the complex Interpret() nesting confuses its cycle
    detection into believing that Interpret() can simply return without 
providing
    a value, which is ok if it's called from dependency checking of threaded
    calculation, but is not ok when it's called for a single cell evalution.
    So make the code set cyclic-dependency error even when it's possibly
    inside dependency checking, since if it's really that case, the error
    will be later overwritten by the actual value.
    
    This is still not a completely correct fix, as the document on repeated hard
    recals alternates some cells between correctly reporting an error and 
providing
    some bogus values (e.g. column S in the second sheet). But the document uses
    iteration, which complicates all this stuff even more, and after spending
    quite some time on this I'm still not sure on how to fix that. So at least
    for now, at least avoid the assert.
    
    Change-Id: I395f97d104d98b5c043d1f17878338d3f1b31146
    Reviewed-on: https://gerrit.libreoffice.org/66911
    Tested-by: Jenkins
    Reviewed-by: Dennis Francis <dennis.fran...@collabora.com>
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 900bd2e71990..3137cfd53a42 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1519,9 +1519,10 @@ void ScFormulaCell::Interpret()
 
     ScFormulaCell* pTopCell = mxGroup ? mxGroup->mpTopCell : this;
 
-    if (pTopCell->mbSeenInPath && rRecursionHelper.GetDepComputeLevel() && 
!bRunning)
+    if (pTopCell->mbSeenInPath && rRecursionHelper.GetDepComputeLevel())
     {
         // This call arose from a dependency calculation and we just found a 
cycle.
+        aResult.SetResultError( FormulaError::CircularReference );
         // This will mark all elements in the cycle as parts-of-cycle.
         ScFormulaGroupCycleCheckGuard aCycleCheckGuard(rRecursionHelper, 
pTopCell);
         return;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to