From dfee136f2e176d73c9a4182528508b70b59c2a68 Mon Sep 17 00:00:00 2001
Message-Id: <dfee136f2e176d73c9a4182528508b70b59c2a68.1436402314.git.erack@redhat.com>
From: Eike Rathke <erack@redhat.com>
Date: Thu, 9 Jul 2015 00:18:04 +0200
Subject: [PATCH] Resolves: tdf#84762 collect all recalc-always cells before
setting any dirty
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------erAck-patch-parts"
This is a multi-part message in MIME format.
--------------erAck-patch-parts
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
(cherry picked from commit bf35419b68d7f100a634572236f7d593638981c8)
Conflicts:
sc/source/core/data/documen7.cxx
Change-Id: I38f69bcbb9eb550fb97b0f84bc0cb486863060b4
---
sc/source/core/data/documen7.cxx | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
--------------erAck-patch-parts
Content-Type: text/x-patch; name="0001-Resolves-tdf-84762-collect-all-recalc-always-cells-b.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Resolves-tdf-84762-collect-all-recalc-always-cells-b.patch"
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 60afbf2..eb552cd 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -422,6 +422,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
CalcAll();
else
{
+ ::std::vector<ScFormulaCell*> vAlwaysDirty;
ScFormulaCell* pCell = pFormulaTree;
while ( pCell )
{
@@ -431,12 +432,11 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
{
if ( pCell->GetCode()->IsRecalcModeAlways() )
{
- // pCell wird im SetDirty neu angehaengt!
- ScFormulaCell* pNext = pCell->GetNext();
- pCell->SetDirty();
- // falls pNext==0 und neue abhaengige hinten angehaengt
- // wurden, so macht das nichts, da die alle bDirty sind
- pCell = pNext;
+ // pCell and dependents are to be set dirty again, collect
+ // them first and broadcast afterwards to not break the
+ // FormulaTree chain here.
+ vAlwaysDirty.push_back( pCell);
+ pCell = pCell->GetNext();
}
else
{ // andere simpel berechnen
@@ -446,6 +446,14 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
}
}
}
+ for (::std::vector<ScFormulaCell*>::iterator it( vAlwaysDirty.begin()), itEnd( vAlwaysDirty.end());
+ it != itEnd; ++it)
+ {
+ pCell = *it;
+ if (!pCell->GetDirty())
+ pCell->SetDirty();
+ }
+
bool bProgress = !bOnlyForced && nFormulaCodeInTree && bProgressBar;
if ( bProgress )
ScProgress::CreateInterpretProgress( this, true );
--------------erAck-patch-parts--