Kaydet (Commit) 12f00988 authored tarafından Luboš Luňák's avatar Luboš Luňák

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: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst 080e58a9
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment