Guarantee that InterpretFormulaGroup() is always called first.

This makes it easier to profile group calculations via formula log.
You can always bail out of that function when unfavorable condition
hits.

Change-Id: I49664c3e34b9efc98f39845379631649f76769de
Reviewed-on: https://gerrit.libreoffice.org/30790
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Tested-by: Kohei Yoshida <libreoffice@kohei.us>
This commit is contained in:
Kohei Yoshida 2016-11-11 21:17:01 -05:00 committed by Kohei Yoshida
parent 18629fbb91
commit 545f5f8abd

View File

@ -1537,24 +1537,16 @@ void ScFormulaCell::Interpret()
}
else
{
// Do not attempt to interpret a group when calculations are already
// running, otherwise we may run into a circular reference hell. See
// tdf#95748
if (rRecursionHelper.GetRecursionCount())
InterpretTail( SCITP_NORMAL);
else
{
#if DEBUG_CALCULATION
aDC.enterGroup();
bool bGroupInterpreted = InterpretFormulaGroup();
aDC.leaveGroup();
if (!bGroupInterpreted)
InterpretTail( SCITP_NORMAL);
aDC.enterGroup();
bool bGroupInterpreted = InterpretFormulaGroup();
aDC.leaveGroup();
if (!bGroupInterpreted)
InterpretTail( SCITP_NORMAL);
#else
if (!InterpretFormulaGroup())
InterpretTail( SCITP_NORMAL);
if (!InterpretFormulaGroup())
InterpretTail( SCITP_NORMAL);
#endif
}
}
// While leaving a recursion or iteration stack, insert its cells to the
@ -4033,6 +4025,15 @@ bool ScFormulaCell::InterpretFormulaGroup()
auto aScope = sc::FormulaLogger::get().enterGroup(*pDocument, *this);
if (pDocument->GetRecursionHelper().GetRecursionCount())
{
// Do not attempt to interpret a group when calculations are already
// running, otherwise we may run into a circular reference hell. See
// tdf#95748
aScope.addMessage("group calc disabled during recursive calculation.");
return false;
}
if (mxGroup->meCalcState == sc::GroupCalcDisabled)
{
aScope.addMessage("group calc disabled");