[Libreoffice-commits] core.git: sc/inc sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Mar 13 10:08:11 UTC 2019
sc/inc/formulacell.hxx | 4 +++-
sc/source/core/data/formulacell.cxx | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 6d9b2713b100d7f158d01a9f7eb22072dc014f00
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Mar 12 11:59:29 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Mar 13 11:07:42 2019 +0100
state explicitly how ownership of ScFormulaCell::pCode works
Change-Id: I7c2938cd731ed85dd0f96ac41d0f0a1468ee858c
Reviewed-on: https://gerrit.libreoffice.org/69089
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index ec7c61171ae7..93c18cabcee7 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -128,7 +128,9 @@ private:
SvNumFormatType nFormatType : 16;
ScFormulaResult aResult;
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;
ScFormulaCell* pPrevious;
ScFormulaCell* pNext;
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 782e3d499517..17dc29811ae5 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1124,6 +1124,7 @@ void ScFormulaCell::Compile( const OUString& rFormula, bool bNoListening,
ScTokenArray* pCodeOld = pCode;
ScCompiler aComp( pDocument, aPos, eGrammar);
pCode = aComp.CompileString( rFormula ).release();
+ assert(!mxGroup);
delete pCodeOld;
if( pCode->GetCodeError() == FormulaError::NONE )
{
@@ -1158,6 +1159,7 @@ void ScFormulaCell::Compile(
ScTokenArray* pCodeOld = pCode;
ScCompiler aComp(rCxt, aPos);
pCode = aComp.CompileString( rFormula ).release();
+ assert(!mxGroup);
delete pCodeOld;
if( pCode->GetCodeError() == FormulaError::NONE )
{
@@ -1334,6 +1336,7 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
{
ScTokenArray* pCodeOld = pCode;
pCode = aComp.CompileString( aFormula, aFormulaNmsp ).release();
+ assert(!mxGroup);
delete pCodeOld;
if( pCode->GetCodeError() == FormulaError::NONE )
More information about the Libreoffice-commits
mailing list