Kaydet (Commit) 9b0ee7d2 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in MasterPageDescriptor

Change-Id: I54d46aeec5f74ccf088ea33d03fd1d8a2009d43f
Reviewed-on: https://gerrit.libreoffice.org/49211Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ea385c1a
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <svx/sdrpageuser.hxx> #include <svx/sdrpageuser.hxx>
#include <svx/svdsob.hxx> #include <svx/svdsob.hxx>
#include <memory>
class SdrObject; class SdrObject;
class SfxItemSet; class SfxItemSet;
...@@ -45,7 +46,7 @@ namespace sdr ...@@ -45,7 +46,7 @@ namespace sdr
SdrLayerIDSet maVisibleLayers; SdrLayerIDSet maVisibleLayers;
// ViewContact part // ViewContact part
sdr::contact::ViewContact* mpViewContact; mutable std::unique_ptr<sdr::contact::ViewContact> mpViewContact;
void operator=(const MasterPageDescriptor& rCandidate) = delete; void operator=(const MasterPageDescriptor& rCandidate) = delete;
......
...@@ -45,11 +45,7 @@ namespace sdr ...@@ -45,11 +45,7 @@ namespace sdr
// de-register at used page // de-register at used page
maUsedPage.RemovePageUser(*this); maUsedPage.RemovePageUser(*this);
if(mpViewContact) mpViewContact.reset();
{
delete mpViewContact;
mpViewContact = nullptr;
}
} }
// ViewContact part // ViewContact part
...@@ -57,8 +53,8 @@ namespace sdr ...@@ -57,8 +53,8 @@ namespace sdr
{ {
if(!mpViewContact) if(!mpViewContact)
{ {
const_cast< MasterPageDescriptor* >(this)->mpViewContact = mpViewContact.reset(
new sdr::contact::ViewContactOfMasterPageDescriptor(*const_cast< MasterPageDescriptor* >(this)); new sdr::contact::ViewContactOfMasterPageDescriptor(*const_cast< MasterPageDescriptor* >(this)) );
} }
return *mpViewContact; return *mpViewContact;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment