summaryrefslogtreecommitdiff
path: root/sc/source/core/data/documen7.cxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-09-22 18:55:37 +0300
committerDennis Francis <dennis.francis@collabora.co.uk>2017-11-21 16:09:40 +0530
commit84705061e64b45a69c14219c3611099b6d428f72 (patch)
treef8e7fb5d6f66c3c46dfb2f9aeda7276686853ef3 /sc/source/core/data/documen7.cxx
parent99a36cb35c92e3e6b4ff2db257df221cb74c9eae (diff)
Add "mutation guard" API for ScDocument
USe by adding a ScMutationGuard object to a section of code that shouldn't be run during threaded calculation of a formula group in any of the calculation threads. There are currently several "classes" of mutation as bits of ScMutationGuardFlags, althouh I am not sure whether that will be useful, so far I use just the one same (CORE) in all cases. Currently implemented using mutexes. Possibly a simple bool field in ScDocument would be enough, the multiple flags and mutexes might be over-complicating it? Maybe I misunderstood what I want. Add such mutation guards for some fields of ScDocument. Change-Id: If2a8223c49d36143f2984e0449798271f2b6440d
Diffstat (limited to 'sc/source/core/data/documen7.cxx')
-rw-r--r--sc/source/core/data/documen7.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index b8d577b6b9c8..b35d760137a1 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -361,6 +361,7 @@ void ScDocument::PutInFormulaTree( ScFormulaCell* pCell )
OSL_ENSURE( pCell, "PutInFormulaTree: pCell Null" );
RemoveFromFormulaTree( pCell );
// append
+ ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
if ( pEOFormulaTree )
pEOFormulaTree->SetNext( pCell );
else
@@ -373,6 +374,7 @@ void ScDocument::PutInFormulaTree( ScFormulaCell* pCell )
void ScDocument::RemoveFromFormulaTree( ScFormulaCell* pCell )
{
+ ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
OSL_ENSURE( pCell, "RemoveFromFormulaTree: pCell Null" );
ScFormulaCell* pPrev = pCell->GetPrevious();
assert(pPrev != pCell); // pointing to itself?!?
@@ -429,6 +431,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
if ( IsCalculatingFormulaTree() )
return ;
+ ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
mpFormulaGroupCxt.reset();
bCalculatingFormulaTree = true;