diff options
-rw-r--r-- | include/svx/sdrmasterpagedescriptor.hxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/sdrmasterpagedescriptor.cxx | 10 |
2 files changed, 5 insertions, 8 deletions
diff --git a/include/svx/sdrmasterpagedescriptor.hxx b/include/svx/sdrmasterpagedescriptor.hxx index f719bca5322e..a072ed6ba5aa 100644 --- a/include/svx/sdrmasterpagedescriptor.hxx +++ b/include/svx/sdrmasterpagedescriptor.hxx @@ -22,6 +22,7 @@ #include <svx/sdrpageuser.hxx> #include <svx/svdsob.hxx> +#include <memory> class SdrObject; class SfxItemSet; @@ -45,7 +46,7 @@ namespace sdr SdrLayerIDSet maVisibleLayers; // ViewContact part - sdr::contact::ViewContact* mpViewContact; + mutable std::unique_ptr<sdr::contact::ViewContact> mpViewContact; void operator=(const MasterPageDescriptor& rCandidate) = delete; diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 3bc645fb4dc7..89f042c087e0 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -45,11 +45,7 @@ namespace sdr // de-register at used page maUsedPage.RemovePageUser(*this); - if(mpViewContact) - { - delete mpViewContact; - mpViewContact = nullptr; - } + mpViewContact.reset(); } // ViewContact part @@ -57,8 +53,8 @@ namespace sdr { if(!mpViewContact) { - const_cast< MasterPageDescriptor* >(this)->mpViewContact = - new sdr::contact::ViewContactOfMasterPageDescriptor(*const_cast< MasterPageDescriptor* >(this)); + mpViewContact.reset( + new sdr::contact::ViewContactOfMasterPageDescriptor(*const_cast< MasterPageDescriptor* >(this)) ); } return *mpViewContact; |