summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-06-20 17:22:14 +0200
committerEike Rathke <erack@redhat.com>2018-06-20 22:06:22 +0200
commit8cbd64985af140b2afac6ea2fd3b9b93300f6f7c (patch)
tree4f16cbf13f29d7dce97f6cc427247262d17a0706
parent202add7f817b6360956b5a41427ee83fa87b7a01 (diff)
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 <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 678f8ab7eb90f5b0dd99328957b21d11e3be68b4) Reviewed-on: https://gerrit.libreoffice.org/56178
-rw-r--r--sc/source/core/data/formulacell.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index e996b8c2318f..d20ea590441d 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.