sc/inc/colorscale.hxx                          |    2 +-
 sc/source/core/data/colorscale.cxx             |    6 +++---
 sc/source/filter/oox/condformatbuffer.cxx      |    2 +-
 sc/source/filter/xml/xmlcondformat.cxx         |    2 +-
 sc/source/ui/condformat/colorformat.cxx        |    2 +-
 sc/source/ui/condformat/condformatdlgentry.cxx |    4 ++--
 6 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 41a86d795ef34124a43e1ddab2bcbc8cf122ec83
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Sep 14 10:56:21 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Sep 15 09:46:03 2020 +0200

    ScColorScaleEntry::SetFormula always dereferences its ScDocument* arg
    
    Change-Id: I5e539a952650707810686fa3d3c14cc79a482173
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102662
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 2f325c4d0f79..c6539ec52409 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -62,7 +62,7 @@ public:
     void SetColor(const Color&);
     double GetValue() const;
     void SetValue(double nValue);
-    void SetFormula(const OUString& rFormula, ScDocument* pDoc, const 
ScAddress& rAddr,
+    void SetFormula(const OUString& rFormula, ScDocument& rDoc, const 
ScAddress& rAddr,
             formula::FormulaGrammar::Grammar eGrammar = 
formula::FormulaGrammar::GRAM_DEFAULT);
 
     void UpdateReference( const sc::RefUpdateContext& rCxt );
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index f920985d7263..a9b047ae8274 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -203,10 +203,10 @@ ScColorScaleEntry::~ScColorScaleEntry() 
COVERITY_NOEXCEPT_FALSE
         mpCell->EndListeningTo(*mpCell->GetDocument());
 }
 
-void ScColorScaleEntry::SetFormula( const OUString& rFormula, ScDocument* 
pDoc, const ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar )
+void ScColorScaleEntry::SetFormula( const OUString& rFormula, ScDocument& 
rDoc, const ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar )
 {
-    mpCell.reset(new ScFormulaCell( pDoc, rAddr, rFormula, eGrammar ));
-    mpCell->StartListeningTo( *pDoc );
+    mpCell.reset(new ScFormulaCell( &rDoc, rAddr, rFormula, eGrammar ));
+    mpCell->StartListeningTo( rDoc );
     mpListener.reset(new ScFormulaListener(mpCell.get()));
     if (mpFormat)
         mpListener->setCallback([&]() { mpFormat->DoRepaint();});
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 3b67674e254a..348d898bab21 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -240,7 +240,7 @@ ScColorScaleEntry* ConvertToModel( const 
ColorScaleRuleModelEntry& rEntry, ScDoc
         if(!rEntry.maFormula.isEmpty())
         {
             pEntry->SetType(COLORSCALE_FORMULA);
-            pEntry->SetFormula(rEntry.maFormula, pDoc, rAddr, 
formula::FormulaGrammar::GRAM_ENGLISH_XL_A1);
+            pEntry->SetFormula(rEntry.maFormula, *pDoc, rAddr, 
formula::FormulaGrammar::GRAM_ENGLISH_XL_A1);
         }
 
         return pEntry;
diff --git a/sc/source/filter/xml/xmlcondformat.cxx 
b/sc/source/filter/xml/xmlcondformat.cxx
index 41c8bbee7f3a..318e7c079458 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -847,7 +847,7 @@ void setColorEntryType(const OUString& rType, 
ScColorScaleEntry* pEntry, const O
     {
         pEntry->SetType(COLORSCALE_FORMULA);
         //position does not matter, only table is important
-        pEntry->SetFormula(rFormula, rImport.GetDocument(), 
ScAddress(0,0,rImport.GetTables().GetCurrentSheet()), 
formula::FormulaGrammar::GRAM_ODFF);
+        pEntry->SetFormula(rFormula, *rImport.GetDocument(), 
ScAddress(0,0,rImport.GetTables().GetCurrentSheet()), 
formula::FormulaGrammar::GRAM_ODFF);
     }
     else if(rType == "auto-minimum")
         pEntry->SetType(COLORSCALE_AUTO);
diff --git a/sc/source/ui/condformat/colorformat.cxx 
b/sc/source/ui/condformat/colorformat.cxx
index a5935d48e863..974cd567b9a3 100644
--- a/sc/source/ui/condformat/colorformat.cxx
+++ b/sc/source/ui/condformat/colorformat.cxx
@@ -42,7 +42,7 @@ void GetType(const weld::ComboBox& rLstBox, const 
weld::Entry& rEd, ScColorScale
             pEntry->SetValue(nVal);
             break;
         case COLORSCALE_FORMULA:
-            pEntry->SetFormula(rEd.get_text(), pDoc, rPos);
+            pEntry->SetFormula(rEd.get_text(), *pDoc, rPos);
             break;
     }
 }
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx 
b/sc/source/ui/condformat/condformatdlgentry.cxx
index 589b9c50f5ca..1bd243ff235e 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -699,7 +699,7 @@ void SetColorScaleEntry(ScColorScaleEntry* pEntry, const 
weld::ComboBox& rType,
             }
             break;
         case COLORSCALE_FORMULA:
-            pEntry->SetFormula(rValue.get_text(), pDoc, rPos);
+            pEntry->SetFormula(rValue.get_text(), *pDoc, rPos);
             break;
         default:
             break;
@@ -1398,7 +1398,7 @@ ScColorScaleEntry* 
ScIconSetFrmtDataEntry::CreateEntry(ScDocument* pDoc, const S
             break;
         case 3:
             pEntry->SetType(COLORSCALE_FORMULA);
-            pEntry->SetFormula(aText, pDoc, rPos, pDoc->GetGrammar());
+            pEntry->SetFormula(aText, *pDoc, rPos, pDoc->GetGrammar());
             break;
         default:
             assert(false);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to