[Libreoffice-commits] core.git: sd/inc sd/source

Stephan Bergmann sbergman at redhat.com
Wed Jun 14 09:47:53 UTC 2017


 sd/inc/sdpage.hxx          |    2 +-
 sd/source/core/sdpage.cxx  |    2 --
 sd/source/core/sdpage2.cxx |    6 +++---
 3 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 02d306a23acf842e62dfc317396296425b31c964
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jun 14 11:47:28 2017 +0200

    Use unique_ptr for SdPage::mpItems
    
    Change-Id: I28025e8896331926d30e748f7c945973b978cb32

diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index 45d3b0e78262..4fef9099de04 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -134,7 +134,7 @@ protected:
 
     virtual css::uno::Reference< css::uno::XInterface > createUnoPage() override;
 
-    SfxItemSet* mpItems;
+    std::unique_ptr<SfxItemSet> mpItems;
 
     SfxItemSet* getOrCreateItems();
 
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 6cb7963bcacd..dd4f403344a2 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -185,8 +185,6 @@ SdPage::~SdPage()
 
     clearChildNodes(mxAnimationNode);
 
-    delete mpItems;
-
     Clear();
 }
 
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 977038901c9a..c8c5b946776c 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -19,7 +19,7 @@
 
 #include <vector>
 #include <libxml/xmlwriter.h>
-
+#include <o3tl/make_unique.hxx>
 #include <sfx2/docfile.hxx>
 #include <vcl/svapp.hxx>
 #include <editeng/outliner.hxx>
@@ -479,9 +479,9 @@ SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const
 SfxItemSet* SdPage::getOrCreateItems()
 {
     if( mpItems == nullptr )
-        mpItems = new SfxItemSet( pModel->GetItemPool(), SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES );
+        mpItems = o3tl::make_unique<SfxItemSet>( pModel->GetItemPool(), SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES );
 
-    return mpItems;
+    return mpItems.get();
 }
 
 bool SdPage::setAlienAttributes( const css::uno::Any& rAttributes )


More information about the Libreoffice-commits mailing list