summaryrefslogtreecommitdiff
path: root/sc/source/core/data/formulacell.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-05 18:47:07 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-05 18:52:10 -0500
commit95637452609260c97d8e5aaa7500531bb458a8bc (patch)
tree14fc0e4a12b26eb3d6eacf108208576b1ec5981d /sc/source/core/data/formulacell.cxx
parent2b78f2cd7b9e4bab0f3b3b9119238f36a1bbc7b2 (diff)
Fix incorrect group calc state check.
And the code in the else block is pretty dangerous as it passes an empty token array to the group interpreter whose effect is entirely unpredictable. Also, declare the destructor of CompiledFormula class to be virtual as it serves as a base class for DynamicKernel. Change-Id: I4e191550a4437ad6ebac55fcdeee4f3654722ff1
Diffstat (limited to 'sc/source/core/data/formulacell.cxx')
-rw-r--r--sc/source/core/data/formulacell.cxx44
1 files changed, 16 insertions, 28 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 852882896009..3b20408568d6 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3660,38 +3660,26 @@ bool ScFormulaCell::InterpretFormulaGroup()
if (mxGroup->mbInvariant && false)
return InterpretInvariantFormulaGroup();
- if (mxGroup->meCalcState == sc::GroupCalcEnabled)
- {
- ScTokenArray aCode;
- ScAddress aTopPos = aPos;
- aTopPos.SetRow(mxGroup->mpTopCell->aPos.Row());
- ScGroupTokenConverter aConverter(aCode, *pDocument, *this, mxGroup->mpTopCell->aPos);
- if (!aConverter.convert(*pCode))
- {
- SAL_INFO("sc.opencl", "conversion of group " << this << " failed, disabling");
- mxGroup->meCalcState = sc::GroupCalcDisabled;
- return false;
- }
- mxGroup->meCalcState = sc::GroupCalcRunning;
- if (!sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aCode))
- {
- SAL_INFO("sc.opencl", "interpreting group " << mxGroup << " (state " << mxGroup->meCalcState << ") failed, disabling");
- mxGroup->meCalcState = sc::GroupCalcDisabled;
- return false;
- }
- mxGroup->meCalcState = sc::GroupCalcEnabled;
+ ScTokenArray aCode;
+ ScAddress aTopPos = aPos;
+ aTopPos.SetRow(mxGroup->mpTopCell->aPos.Row());
+ ScGroupTokenConverter aConverter(aCode, *pDocument, *this, mxGroup->mpTopCell->aPos);
+ if (!aConverter.convert(*pCode))
+ {
+ SAL_INFO("sc.opencl", "conversion of group " << this << " failed, disabling");
+ mxGroup->meCalcState = sc::GroupCalcDisabled;
+ return false;
}
- else
+
+ mxGroup->meCalcState = sc::GroupCalcRunning;
+ if (!sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aCode))
{
- ScTokenArray aDummy;
- if (!sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aDummy))
- {
- SAL_INFO("sc.opencl", "interpreting group " << mxGroup << " (state " << mxGroup->meCalcState << ") failed, disabling");
- mxGroup->meCalcState = sc::GroupCalcDisabled;
- return false;
- }
+ SAL_INFO("sc.opencl", "interpreting group " << mxGroup << " (state " << mxGroup->meCalcState << ") failed, disabling");
+ mxGroup->meCalcState = sc::GroupCalcDisabled;
+ return false;
}
+ mxGroup->meCalcState = sc::GroupCalcEnabled;
return true;
}