summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2018-11-07 15:35:26 +0100
committerLuboš Luňák <l.lunak@collabora.com>2018-11-14 16:10:02 +0100
commit12f00988c2360713885ecf7eb4b643dd118cd051 (patch)
tree6a9a0c1d2b48909f7443c949c4020c0d71682402 /sc/source
parent080e58a9f69ea0e1c815eb66427baf2c6b330d9e (diff)
make sure ScConditionEntry::Interpret() doesn't confuse calc threading
ScConditionEntry::Interpret() creates a temporary cell and interprets it without it actually being in the document at the specified position, which threading relies upon. Change-Id: I06fcc11dfbe14e715de4c173e061064ac90da990 Reviewed-on: https://gerrit.libreoffice.org/63182 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/column2.cxx9
-rw-r--r--sc/source/core/data/formulacell.cxx15
2 files changed, 24 insertions, 0 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 93bcf9bd6531..a4078e75427d 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2902,8 +2902,11 @@ void ScColumn::SetFormulaResults( SCROW nRow, const double* pResults, size_t nLe
sc::CellStoreType::position_type aPos = maCells.position(nRow);
sc::CellStoreType::iterator it = aPos.first;
if (it->type != sc::element_type_formula)
+ {
// This is not a formula block.
+ assert( false );
return;
+ }
size_t nBlockLen = it->size - aPos.second;
if (nBlockLen < nLen)
@@ -2934,8 +2937,11 @@ void ScColumn::CalculateInThread( ScInterpreterContext& rContext, SCROW nRow, si
sc::CellStoreType::position_type aPos = maCells.position(nRow);
sc::CellStoreType::iterator it = aPos.first;
if (it->type != sc::element_type_formula)
+ {
// This is not a formula block.
+ assert( false );
return;
+ }
size_t nBlockLen = it->size - aPos.second;
if (nBlockLen < nLen)
@@ -2962,8 +2968,11 @@ void ScColumn::HandleStuffAfterParallelCalculation( SCROW nRow, size_t nLen )
sc::CellStoreType::position_type aPos = maCells.position(nRow);
sc::CellStoreType::iterator it = aPos.first;
if (it->type != sc::element_type_formula)
+ {
// This is not a formula block.
+ assert( false );
return;
+ }
size_t nBlockLen = it->size - aPos.second;
if (nBlockLen < nLen)
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 8d16fdf0d352..6d284ff43dbf 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4523,6 +4523,21 @@ bool ScFormulaCell::InterpretFormulaGroup()
return false;
}
+ if( forceType != ForceCalculationNone )
+ {
+ // ScConditionEntry::Interpret() creates a temporary cell and interprets it
+ // without it actually being in the document at the specified position.
+ // That would confuse opencl/threading code, as they refer to the cell group
+ // also using the position. This is normally not triggered (single cells
+ // are normally not in a cell group), but if forced, check for this explicitly.
+ if( pDocument->GetFormulaCell( aPos ) != this )
+ {
+ mxGroup->meCalcState = sc::GroupCalcDisabled;
+ aScope.addMessage("cell not in document");
+ return false;
+ }
+ }
+
// Guard against endless recursion of Interpret() calls, for this to work
// ScFormulaCell::InterpretFormulaGroup() must never be called through
// anything else than ScFormulaCell::Interpret(), same as