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

Noel Grandin noel.grandin at collabora.co.uk
Thu Oct 19 09:05:02 UTC 2017


 include/svx/unoprov.hxx        |    3 ++-
 svx/source/unodraw/unoprov.cxx |    6 ++----
 2 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 3991cd38484883b8544be908b6834564345fd0f1
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Oct 18 13:32:59 2017 +0200

    use std::unique_ptr in SvxUnoPropertyMapProvider
    
    Change-Id: I774718e74bdf2e022a01188a05c8928813ad653f
    Reviewed-on: https://gerrit.libreoffice.org/43524
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/unoprov.hxx b/include/svx/unoprov.hxx
index 7d2651c6bfd8..8a2d7d977f51 100644
--- a/include/svx/unoprov.hxx
+++ b/include/svx/unoprov.hxx
@@ -26,6 +26,7 @@
 #include <svx/svxdllapi.h>
 #include <editeng/unoipset.hxx>
 #include <rtl/ref.hxx>
+#include <memory>
 
 
 class SvxItemPropertySet;
@@ -84,7 +85,7 @@ public:
 class SVX_DLLPUBLIC SvxUnoPropertyMapProvider
 {
     SfxItemPropertyMapEntry const * aMapArr[SVXMAP_END];
-    SvxItemPropertySet* aSetArr[SVXMAP_END];
+    std::unique_ptr<SvxItemPropertySet> aSetArr[SVXMAP_END];
 public:
     SvxUnoPropertyMapProvider();
     ~SvxUnoPropertyMapProvider();
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index abe266261ec6..ff8a6f48cd1d 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -902,8 +902,6 @@ SvxUnoPropertyMapProvider::SvxUnoPropertyMapProvider()
 
 SvxUnoPropertyMapProvider::~SvxUnoPropertyMapProvider()
 {
-    for(SvxItemPropertySet* p : aSetArr)
-        delete p;
 }
 
 
@@ -949,8 +947,8 @@ const SfxItemPropertyMapEntry* SvxUnoPropertyMapProvider::GetMap(sal_uInt16 nPro
 const SvxItemPropertySet* SvxUnoPropertyMapProvider::GetPropertySet(sal_uInt16 nPropertyId, SfxItemPool& rPool)
 {
     if( !aSetArr[nPropertyId] )
-        aSetArr[nPropertyId] = new SvxItemPropertySet( GetMap( nPropertyId ), rPool );
-    return aSetArr[nPropertyId];
+        aSetArr[nPropertyId].reset(new SvxItemPropertySet( GetMap( nPropertyId ), rPool ));
+    return aSetArr[nPropertyId].get();
 }
 
 /** maps the vcl MapUnit enum to a API constant MeasureUnit.


More information about the Libreoffice-commits mailing list