[Libreoffice-commits] core.git: include/svx svx/source

Kohei Yoshida kohei.yoshida at gmail.com
Sun Dec 20 16:25:05 PST 2015


 include/svx/svdpage.hxx       |    6 +++---
 svx/source/svdraw/svdpage.cxx |   26 ++++++++++++++------------
 2 files changed, 17 insertions(+), 15 deletions(-)

New commits:
commit 8c55875546aed040609858319707e2b91426fbe0
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Sun Dec 20 14:17:19 2015 -0500

    Use std::unique_ptr for the SdrPageProperties member of SdrPage.
    
    Change-Id: I37d95bd91c5bee1028eceda24e84b17162d0d2b1
    Reviewed-on: https://gerrit.libreoffice.org/20844
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 7e1d15f..6b7d4d2 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -414,12 +414,12 @@ public:
 
 private:
     std::unique_ptr<SdrLayerAdmin> mpLayerAdmin;
-    SdrPageProperties*  mpSdrPageProperties;
+    std::unique_ptr<SdrPageProperties> mpSdrPageProperties;
     css::uno::Reference< css::uno::XInterface > mxUnoPage;
 
 public:
-    SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; }
-    const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; }
+    SdrPageProperties& getSdrPageProperties();
+    const SdrPageProperties& getSdrPageProperties() const;
     const SdrPageProperties* getCorrectSdrPageProperties() const;
 
 protected:
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index d6679ff..870186f 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1219,7 +1219,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage)
     aPrefVisiLayers.SetAll();
     eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
 
-    mpSdrPageProperties = new SdrPageProperties(*this);
+    mpSdrPageProperties.reset(new SdrPageProperties(*this));
 }
 
 SdrPage::SdrPage(const SdrPage& rSrcPage)
@@ -1278,12 +1278,7 @@ SdrPage::~SdrPage()
     TRG_ClearMasterPage();
 
     mpViewContact.reset();
-
-    {
-        delete mpSdrPageProperties;
-        mpSdrPageProperties = nullptr;
-    }
-
+    mpSdrPageProperties.reset();
 }
 
 void SdrPage::lateInit(const SdrPage& rSrcPage, SdrModel* const pNewModel)
@@ -1325,7 +1320,7 @@ void SdrPage::lateInit(const SdrPage& rSrcPage, SdrModel* const pNewModel)
     mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent;
 
     {
-        mpSdrPageProperties = new SdrPageProperties(*this);
+        mpSdrPageProperties.reset(new SdrPageProperties(*this));
 
         if(!IsMasterPage())
         {
@@ -1524,7 +1519,7 @@ void SdrPage::SetModel(SdrModel* pNewModel)
 
         // create new SdrPageProperties with new model (due to SfxItemSet there)
         // and copy ItemSet and StyleSheet
-        SdrPageProperties *pNew = new SdrPageProperties(*this);
+        std::unique_ptr<SdrPageProperties> pNew(new SdrPageProperties(*this));
 
         if(!IsMasterPage())
         {
@@ -1533,8 +1528,7 @@ void SdrPage::SetModel(SdrModel* pNewModel)
 
         pNew->SetStyleSheet(getSdrPageProperties().GetStyleSheet());
 
-        delete mpSdrPageProperties;
-        mpSdrPageProperties = pNew;
+        mpSdrPageProperties = std::move(pNew);
     }
 
     // update listeners at possible API wrapper object
@@ -1792,7 +1786,15 @@ void SdrPage::ActionChanged()
     }
 }
 
-// sdr::Comment interface
+SdrPageProperties& SdrPage::getSdrPageProperties()
+{
+    return *mpSdrPageProperties;
+}
+
+const SdrPageProperties& SdrPage::getSdrPageProperties() const
+{
+    return *mpSdrPageProperties;
+}
 
 const SdrPageProperties* SdrPage::getCorrectSdrPageProperties() const
 {


More information about the Libreoffice-commits mailing list