sd/source/ui/unoidl/unopback.cxx | 11 ++++------- sd/source/ui/unoidl/unopback.hxx | 6 +++++- 2 files changed, 9 insertions(+), 8 deletions(-)
New commits: commit f057aa19536f85a9fe63dc8db7a8da98d858033a Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Jun 15 13:06:17 2017 +0200 Use unique_ptr for SdUnoPageBackground::mpSet Change-Id: Ia7eabedb745c515022241ef05f682e7301d327c2 diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index e65af781d435..e588d0b1bc63 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -18,6 +18,7 @@ */ #include <com/sun/star/drawing/BitmapMode.hpp> +#include <o3tl/make_unique.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <svl/itemset.hxx> @@ -54,13 +55,12 @@ SdUnoPageBackground::SdUnoPageBackground( SdDrawDocument* pDoc /* = NULL */, const SfxItemSet* pSet /* = NULL */) throw() : mpPropSet(ImplGetPageBackgroundPropertySet()), - mpSet(nullptr), mpDoc(pDoc) { if( pDoc ) { StartListening( *pDoc ); - mpSet = new SfxItemSet( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST ); + mpSet = o3tl::make_unique<SfxItemSet>( pDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST ); if( pSet ) mpSet->Put(*pSet); @@ -73,8 +73,6 @@ SdUnoPageBackground::~SdUnoPageBackground() throw() if( mpDoc ) EndListening( *mpDoc ); - - delete mpSet; } void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -87,8 +85,7 @@ void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint ) // will also die if( pSdrHint->GetKind() == SdrHintKind::ModelCleared ) { - delete mpSet; - mpSet = nullptr; + mpSet.reset(); mpDoc = nullptr; } } @@ -104,7 +101,7 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) StartListening( *pDoc ); mpDoc = pDoc; - mpSet = new SfxItemSet( *rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST ); + mpSet = o3tl::make_unique<SfxItemSet>( *rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST ); if( mpPropSet->AreThereOwnUsrAnys() ) { diff --git a/sd/source/ui/unoidl/unopback.hxx b/sd/source/ui/unoidl/unopback.hxx index d163f0f0dfee..0c611f472ace 100644 --- a/sd/source/ui/unoidl/unopback.hxx +++ b/sd/source/ui/unoidl/unopback.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_SD_SOURCE_UI_UNOIDL_UNOPBACK_HXX #define INCLUDED_SD_SOURCE_UI_UNOIDL_UNOPBACK_HXX +#include <sal/config.h> + +#include <memory> + #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -44,7 +48,7 @@ class SdUnoPageBackground : public ::cppu::WeakImplHelper< { protected: const SvxItemPropertySet* mpPropSet; - SfxItemSet* mpSet; + std::unique_ptr<SfxItemSet> mpSet; SdrModel* mpDoc; const SfxItemPropertySimpleEntry* getPropertyMapEntry( const OUString& rPropertyName ) const throw(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits