diff options
Diffstat (limited to 'svx/source/sdr/properties')
-rw-r--r-- | svx/source/sdr/properties/attributeproperties.cxx | 20 | ||||
-rw-r--r-- | svx/source/sdr/properties/defaultproperties.cxx | 13 | ||||
-rw-r--r-- | svx/source/sdr/properties/groupproperties.cxx | 3 |
3 files changed, 13 insertions, 23 deletions
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index d18959eb4ca1..369c6bd3cd77 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <utility> + #include <sdr/properties/attributeproperties.hxx> #include <sdr/properties/itemsettools.hxx> #include <tools/debug.hxx> @@ -253,7 +257,6 @@ namespace sdr // because this functionality is used by UNDO only. Thus // objects and ItemSets would be moved back to their original // pool before usage. - SfxItemSet* pOldSet = mpItemSet; SfxStyleSheet* pStySheet = GetStyleSheet(); if(pStySheet) @@ -261,8 +264,9 @@ namespace sdr ImpRemoveStyleSheet(); } - mpItemSet = mpItemSet->Clone(false, pDestPool); - SdrModel::MigrateItemSet(pOldSet, mpItemSet, pNewModel); + auto pOldSet = std::move(mpItemSet); + mpItemSet.reset(pOldSet->Clone(false, pDestPool)); + SdrModel::MigrateItemSet(pOldSet.get(), mpItemSet.get(), pNewModel); // set stylesheet (if used) if(pStySheet) @@ -297,8 +301,6 @@ namespace sdr ImpAddStyleSheet(pNewStyleSheet, true); } } - - delete pOldSet; } } } @@ -451,12 +453,9 @@ namespace sdr { ImpRemoveStyleSheet(); } - - delete mpItemSet; - mpItemSet = nullptr; } - mpItemSet = pNewSet; + mpItemSet.reset(pNewSet); } } } @@ -503,8 +502,7 @@ namespace sdr } // replace itemsets - delete mpItemSet; - mpItemSet = pDestItemSet; + mpItemSet.reset(pDestItemSet); // set necessary changes like in RemoveStyleSheet() GetSdrObject().SetBoundRectDirty(); diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index 3904ef5c6f20..3d53ddec61fe 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -53,7 +53,7 @@ namespace sdr { if(rProps.mpItemSet) { - mpItemSet = rProps.mpItemSet->Clone(); + mpItemSet.reset(rProps.mpItemSet->Clone()); // do not keep parent info, this may be changed by later constructors. // This class just copies the ItemSet, ignore parent. @@ -69,20 +69,13 @@ namespace sdr return *(new DefaultProperties(*this, rObj)); } - DefaultProperties::~DefaultProperties() - { - if(mpItemSet) - { - delete mpItemSet; - mpItemSet = nullptr; - } - } + DefaultProperties::~DefaultProperties() {} const SfxItemSet& DefaultProperties::GetObjectItemSet() const { if(!mpItemSet) { - const_cast<DefaultProperties*>(this)->mpItemSet = const_cast<DefaultProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()); + const_cast<DefaultProperties*>(this)->mpItemSet.reset(const_cast<DefaultProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool())); const_cast<DefaultProperties*>(this)->ForceDefaultAttributes(); } diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx index 00932e8eca82..4dfc770e0888 100644 --- a/svx/source/sdr/properties/groupproperties.cxx +++ b/svx/source/sdr/properties/groupproperties.cxx @@ -263,8 +263,7 @@ namespace sdr // The ItemSet for merge is constructed on demand, so it's enough here to // just delete it and set to 0L. // mpItemSet->ClearItem(); - delete mpItemSet; - mpItemSet = nullptr; + mpItemSet.reset(); } } } |