[Libreoffice-commits] core.git: sw/inc sw/source

Michael Stahl mstahl at redhat.com
Thu Feb 15 14:55:18 UTC 2018


 sw/inc/unoframe.hxx                 |    2 +-
 sw/source/core/unocore/unoframe.cxx |    9 +++------
 2 files changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 0310430ed0455418cfe85e150f14496aff724897
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Feb 14 14:43:04 2018 +0100

    sw: replace DELETEZ with unique_ptr in SwXFrame
    
    Change-Id: I93043bd17a685a82f9365c3eeb27d4288291e2f3
    Reviewed-on: https://gerrit.libreoffice.org/49731
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index f913fb708cd2..de5c9b8ac71a 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -71,7 +71,7 @@ private:
     bool bIsDescriptor;
     OUString                        m_sName;
 
-    SwPaM*                          m_pCopySource;
+    std::unique_ptr<SwPaM>          m_pCopySource;
 
     sal_Int64                       m_nDrawAspect;
 
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 9b886f7e1682..0ab6c8c26aa1 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1199,7 +1199,6 @@ SwXFrame::SwXFrame(FlyCntType eSet, const ::SfxItemPropertySet* pSet, SwDoc *pDo
     , m_pDoc(pDoc)
     , eType(eSet)
     , bIsDescriptor(true)
-    , m_pCopySource(nullptr)
     , m_nDrawAspect(embed::Aspects::MSOLE_CONTENT)
 {
     // Register ourselves as a listener to the document (via the page descriptor)
@@ -1253,7 +1252,6 @@ SwXFrame::SwXFrame(SwFrameFormat& rFrameFormat, FlyCntType eSet, const ::SfxItem
     , m_pDoc(nullptr)
     , eType(eSet)
     , bIsDescriptor(false)
-    , m_pCopySource(nullptr)
     , m_nDrawAspect(embed::Aspects::MSOLE_CONTENT)
 {
 }
@@ -1261,7 +1259,7 @@ SwXFrame::SwXFrame(SwFrameFormat& rFrameFormat, FlyCntType eSet, const ::SfxItem
 SwXFrame::~SwXFrame()
 {
     SolarMutexGuard aGuard;
-    delete m_pCopySource;
+    m_pCopySource.reset();
     m_pProps.reset();
     EndListeningAll();
 }
@@ -1352,8 +1350,7 @@ uno::Reference< beans::XPropertySetInfo >  SwXFrame::getPropertySetInfo()
 
 void SwXFrame::SetSelection(SwPaM& rCopySource)
 {
-    delete m_pCopySource;
-    m_pCopySource = new SwPaM( *rCopySource.Start() );
+    m_pCopySource.reset(new SwPaM(*rCopySource.Start()));
     m_pCopySource->SetMark();
     *m_pCopySource->GetMark() = *rCopySource.End();
 }
@@ -2785,7 +2782,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
                 pDoc->SetFlyFrameAttr( *pFormat, aAnchorSet );
                 delete pAnchorItem;
             }
-            DELETEZ( m_pCopySource );
+            m_pCopySource.reset();
         }
         else
         {


More information about the Libreoffice-commits mailing list