[Libreoffice-commits] core.git: sc/source

Stephan Bergmann sbergman at redhat.com
Mon May 26 14:30:36 PDT 2014


 sc/source/core/data/formulacell.cxx |   46 ++----------------------------------
 1 file changed, 3 insertions(+), 43 deletions(-)

New commits:
commit 22fd097f37b905cb3b585caf96890690befed863
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon May 26 23:17:11 2014 +0200

    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

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 5a79aaa..dedba62 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() )


More information about the Libreoffice-commits mailing list