Kaydet (Commit) 22fd097f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Revert "ODS load perf: accelerate CompileXML for formula by stringify and...

...compare."

This reverts commit 4a5d600a (plus follow-up
8400f109 "ODS load perf: remove left-over /
debugging getenv").  It causes crashes due to stale heap access in
CppunitTest_sc_subsequent_filters_test etc. when ScFormulaCell::CompileXML first
calls SetCellGroup, which deletes pCode, and then calls aComp.CompileTokenArray,
where aComp has earlier been instantiated on *pCode and now calls GetCodeError
on it.

Change-Id: I9c86d26604b2895e92dce38611a1f8d1f099494d
üst 7da3ce7c
...@@ -1184,49 +1184,9 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr ...@@ -1184,49 +1184,9 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
// pCode may not deleted for queries, but must be empty // pCode may not deleted for queries, but must be empty
if ( pCode ) if ( pCode )
pCode->Clear(); pCode->Clear();
ScTokenArray* pCodeOld = pCode;
bool bSkipCompile = false; pCode = aComp.CompileString( aFormula, aFormulaNmsp );
delete pCodeOld;
if ( !mxGroup && aFormulaNmsp.isEmpty() ) // optimization
{
ScAddress aPreviousCell( aPos );
aPreviousCell.IncRow( -1 );
ScFormulaCell *pPreviousCell = pDocument->GetFormulaCell( aPreviousCell );
if( pPreviousCell )
{
// Now try to convert to a string quickly ...
ScCompiler aBackComp( rCxt, aPos, *(pPreviousCell->pCode) );
OUStringBuffer aShouldBeBuf;
aBackComp.CreateStringFromTokenArray( aShouldBeBuf );
assert( aFormula[0] == '=' );
OUString aShouldBe = aShouldBeBuf.makeStringAndClear();
if( aFormula.getLength() == aShouldBe.getLength() + 1 &&
aFormula.match( aShouldBe, 1 ) ) // initial '='
{
// Put them in the same formula group.
ScFormulaCellGroupRef xGroup = pPreviousCell->GetCellGroup();
if (!xGroup) // Last cell is not grouped yet. Start a new group.
xGroup = pPreviousCell->CreateCellGroup(1, false);
++xGroup->mnLength;
SetCellGroup( xGroup );
bSkipCompile = true;
SAL_INFO( "sc", "merged '" << aFormula << "' == "
"'" << aShouldBe << "'" <<
" extend group to " << xGroup->mnLength );
}
}
}
if (!bSkipCompile)
{
ScTokenArray* pCodeOld = pCode;
pCode = aComp.CompileString( aFormula, aFormulaNmsp );
delete pCodeOld;
}
if( !pCode->GetCodeError() ) if( !pCode->GetCodeError() )
{ {
if ( !pCode->GetLen() ) if ( !pCode->GetLen() )
......
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