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

New commits:
commit 678f8ab7eb90f5b0dd99328957b21d11e3be68b4
Author: Eike Rathke <er...@redhat.com>
Date:   Wed Jun 20 17:22:14 2018 +0200

    Resolves: tdf#117049 do not re-interpret a single circular self-reference
    
    ... to not execute the calculation twice, which added an implicit
    iteration step.
    
    Change-Id: I943f770d32ebe84a8359f2f94c1f0bf5731b6f88
    Reviewed-on: https://gerrit.libreoffice.org/56170
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 5378d0084c31..615dccfce416 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1610,11 +1610,16 @@ void ScFormulaCell::Interpret()
                 else
                 {
                     bResumeIteration = false;
-                    // Close circle once.
-                    pDocument->IncInterpretLevel();
-                    rRecursionHelper.GetList().back().pCell->InterpretTail( 
pDocument->GetNonThreadedContext(),
-                                                                            
SCITP_CLOSE_ITERATION_CIRCLE);
-                    pDocument->DecInterpretLevel();
+                    // Close circle once. If 'this' is self-referencing only
+                    // (e.g. counter or self-adder) then it is already
+                    // implicitly closed.
+                    if (rRecursionHelper.GetList().size() > 1)
+                    {
+                        pDocument->IncInterpretLevel();
+                        rRecursionHelper.GetList().back().pCell->InterpretTail(
+                                pDocument->GetNonThreadedContext(), 
SCITP_CLOSE_ITERATION_CIRCLE);
+                        pDocument->DecInterpretLevel();
+                    }
                     // Start at 1, init things.
                     rRecursionHelper.StartIteration();
                     // Mark all cells being in iteration.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to