[Libreoffice-commits] core.git: svx/inc svx/source
Stephan Bergmann
sbergman at redhat.com
Tue Jun 13 11:04:27 UTC 2017
svx/inc/sdr/properties/emptyproperties.hxx | 9 +++++----
svx/source/sdr/properties/emptyproperties.cxx | 11 +----------
svx/source/sdr/properties/pageproperties.cxx | 2 +-
3 files changed, 7 insertions(+), 15 deletions(-)
New commits:
commit edda154f3eac2508b8aaa7991ad59f3580384b83
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jun 13 13:04:01 2017 +0200
Use unique_ptr for EmptyProperties::mpEmptyItemSet
Change-Id: I167e6ee803ee5c81553e8a5f0d63f2a47195b46a
diff --git a/svx/inc/sdr/properties/emptyproperties.hxx b/svx/inc/sdr/properties/emptyproperties.hxx
index dad630be6fe9..2b431ec7b576 100644
--- a/svx/inc/sdr/properties/emptyproperties.hxx
+++ b/svx/inc/sdr/properties/emptyproperties.hxx
@@ -20,6 +20,10 @@
#ifndef INCLUDED_SVX_SDR_PROPERTIES_EMPTYPROPERTIES_HXX
#define INCLUDED_SVX_SDR_PROPERTIES_EMPTYPROPERTIES_HXX
+#include <sal/config.h>
+
+#include <memory>
+
#include <svx/sdr/properties/properties.hxx>
@@ -31,7 +35,7 @@ namespace sdr
{
protected:
// the to be used ItemSet
- SfxItemSet* mpEmptyItemSet;
+ std::unique_ptr<SfxItemSet> mpEmptyItemSet;
// create a new itemset
virtual SfxItemSet* CreateObjectSpecificItemSet(SfxItemPool& rPool) override;
@@ -52,9 +56,6 @@ namespace sdr
// basic constructor
explicit EmptyProperties(SdrObject& rObj);
- // destructor
- virtual ~EmptyProperties() override;
-
// Clone() operator, normally just calls the local copy constructor
virtual BaseProperties& Clone(SdrObject& rObj) const override;
diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx
index c872d6667ad1..25d7c04ee16b 100644
--- a/svx/source/sdr/properties/emptyproperties.cxx
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -43,15 +43,6 @@ namespace sdr
{
}
- EmptyProperties::~EmptyProperties()
- {
- if(mpEmptyItemSet)
- {
- delete mpEmptyItemSet;
- mpEmptyItemSet = nullptr;
- }
- }
-
BaseProperties& EmptyProperties::Clone(SdrObject& rObj) const
{
return *(new EmptyProperties(rObj));
@@ -61,7 +52,7 @@ namespace sdr
{
if(!mpEmptyItemSet)
{
- const_cast<EmptyProperties*>(this)->mpEmptyItemSet = const_cast<EmptyProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool());
+ const_cast<EmptyProperties*>(this)->mpEmptyItemSet.reset(const_cast<EmptyProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()));
}
assert(mpEmptyItemSet);
diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx
index f2ac2d192583..a4d57fc80602 100644
--- a/svx/source/sdr/properties/pageproperties.cxx
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -60,7 +60,7 @@ namespace sdr
{
if(!mpEmptyItemSet)
{
- const_cast<PageProperties*>(this)->mpEmptyItemSet = const_cast<PageProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool());
+ const_cast<PageProperties*>(this)->mpEmptyItemSet.reset(const_cast<PageProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()));
}
DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
More information about the Libreoffice-commits
mailing list