diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-05-26 23:17:11 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-05-26 23:29:56 +0200 |
commit | 22fd097f37b905cb3b585caf96890690befed863 (patch) | |
tree | b3b652b76030f082de7a41addb48cf3077b1ba98 /sc | |
parent | 7da3ce7cdb05bcced9ba61724e33d7a395e44e10 (diff) |
Revert "ODS load perf: accelerate CompileXML for formula by stringify and...
...compare."
This reverts commit 4a5d600a0ab8b851bd7565e36be3419066145908 (plus follow-up
8400f1092d2ac38ff0570837957250f45c6e156d "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
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 5a79aaae0c3c..dedba629a469 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1184,49 +1184,9 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr // pCode may not deleted for queries, but must be empty if ( pCode ) pCode->Clear(); - - bool bSkipCompile = false; - - 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; - } - + ScTokenArray* pCodeOld = pCode; + pCode = aComp.CompileString( aFormula, aFormulaNmsp ); + delete pCodeOld; if( !pCode->GetCodeError() ) { if ( !pCode->GetLen() ) |