Kaydet (Commit) 6d9b2713 authored tarafından Luboš Luňák's avatar Luboš Luňák

state explicitly how ownership of ScFormulaCell::pCode works

Change-Id: I7c2938cd731ed85dd0f96ac41d0f0a1468ee858c
Reviewed-on: https://gerrit.libreoffice.org/69089
Tested-by: Jenkins
Reviewed-by: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst d68c1ca1
...@@ -128,7 +128,9 @@ private: ...@@ -128,7 +128,9 @@ private:
SvNumFormatType nFormatType : 16; SvNumFormatType nFormatType : 16;
ScFormulaResult aResult; ScFormulaResult aResult;
formula::FormulaGrammar::Grammar eTempGrammar; // used between string (creation) and (re)compilation formula::FormulaGrammar::Grammar eTempGrammar; // used between string (creation) and (re)compilation
ScTokenArray* pCode; // The (new) token array // If this cell is in a cell group (mxGroup!=nullptr), then this pCode is a not-owning pointer
// to the mxGroup's mpCode, which owns the array. If the cell is not in a group, this is an owning pointer.
ScTokenArray* pCode; // The token array
ScDocument* pDocument; ScDocument* pDocument;
ScFormulaCell* pPrevious; ScFormulaCell* pPrevious;
ScFormulaCell* pNext; ScFormulaCell* pNext;
......
...@@ -1124,6 +1124,7 @@ void ScFormulaCell::Compile( const OUString& rFormula, bool bNoListening, ...@@ -1124,6 +1124,7 @@ void ScFormulaCell::Compile( const OUString& rFormula, bool bNoListening,
ScTokenArray* pCodeOld = pCode; ScTokenArray* pCodeOld = pCode;
ScCompiler aComp( pDocument, aPos, eGrammar); ScCompiler aComp( pDocument, aPos, eGrammar);
pCode = aComp.CompileString( rFormula ).release(); pCode = aComp.CompileString( rFormula ).release();
assert(!mxGroup);
delete pCodeOld; delete pCodeOld;
if( pCode->GetCodeError() == FormulaError::NONE ) if( pCode->GetCodeError() == FormulaError::NONE )
{ {
...@@ -1158,6 +1159,7 @@ void ScFormulaCell::Compile( ...@@ -1158,6 +1159,7 @@ void ScFormulaCell::Compile(
ScTokenArray* pCodeOld = pCode; ScTokenArray* pCodeOld = pCode;
ScCompiler aComp(rCxt, aPos); ScCompiler aComp(rCxt, aPos);
pCode = aComp.CompileString( rFormula ).release(); pCode = aComp.CompileString( rFormula ).release();
assert(!mxGroup);
delete pCodeOld; delete pCodeOld;
if( pCode->GetCodeError() == FormulaError::NONE ) if( pCode->GetCodeError() == FormulaError::NONE )
{ {
...@@ -1334,6 +1336,7 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr ...@@ -1334,6 +1336,7 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
{ {
ScTokenArray* pCodeOld = pCode; ScTokenArray* pCodeOld = pCode;
pCode = aComp.CompileString( aFormula, aFormulaNmsp ).release(); pCode = aComp.CompileString( aFormula, aFormulaNmsp ).release();
assert(!mxGroup);
delete pCodeOld; delete pCodeOld;
if( pCode->GetCodeError() == FormulaError::NONE ) if( pCode->GetCodeError() == FormulaError::NONE )
......
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