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

Michael Meeks michael.meeks at collabora.com
Wed May 28 01:03:36 PDT 2014


 sc/source/core/data/formulacell.cxx |   51 +++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 20 deletions(-)

New commits:
commit c3cea107354fecda6dedcd6b998343a2bd33d6f3
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed May 28 08:56:35 2014 +0100

    ODS load perf: avoid re-compiling an already free'd pCode with ScCompiler.
    
    Change-Id: Ia6c3c587302869a42376cda1363ee9df0b7a74f5

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 0429a50..7891500 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1211,6 +1211,17 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
                 ++xGroup->mnLength;
                 SetCellGroup( xGroup );
 
+                // Do setup here based on previous cell.
+
+                nFormatType = pPreviousCell->nFormatType;
+                bSubTotal = pPreviousCell->bSubTotal;
+                bChanged = true;
+                bCompile = false;
+                StartListeningTo( pDocument );
+
+                if (bSubTotal)
+                    pDocument->AddSubTotalCell(this);
+
                 bSkipCompile = true;
                 pCode = pPreviousCell->pCode;
 
@@ -1226,31 +1237,31 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
         ScTokenArray* pCodeOld = pCode;
         pCode = aComp.CompileString( aFormula, aFormulaNmsp );
         delete pCodeOld;
-    }
 
-    if( !pCode->GetCodeError() )
-    {
-        if ( !pCode->GetLen() )
-        {
-            if ( aFormula[0] == '=' )
-                pCode->AddBad( aFormula.copy( 1 ) );
-            else
-                pCode->AddBad( aFormula );
-        }
-        bSubTotal = aComp.CompileTokenArray();
         if( !pCode->GetCodeError() )
         {
-            nFormatType = aComp.GetNumFormatType();
-            bChanged = true;
-            bCompile = false;
-            StartListeningTo( pDocument );
-        }
+            if ( !pCode->GetLen() )
+            {
+                if ( aFormula[0] == '=' )
+                    pCode->AddBad( aFormula.copy( 1 ) );
+                else
+                    pCode->AddBad( aFormula );
+            }
+            bSubTotal = aComp.CompileTokenArray();
+            if( !pCode->GetCodeError() )
+            {
+                nFormatType = aComp.GetNumFormatType();
+                bChanged = true;
+                bCompile = false;
+                StartListeningTo( pDocument );
+            }
 
-        if (bSubTotal)
-            pDocument->AddSubTotalCell(this);
+            if (bSubTotal)
+                pDocument->AddSubTotalCell(this);
+        }
+        else
+            bChanged = true;
     }
-    else
-        bChanged = true;
 
     //  Same as in Load: after loading, it must be known if ocMacro is in any formula
     //  (for macro warning, CompileXML is called at the end of loading XML file)


More information about the Libreoffice-commits mailing list