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

Noel Grandin noel.grandin at collabora.co.uk
Fri Jun 29 06:42:48 UTC 2018


 sw/inc/ndole.hxx             |    2 +-
 sw/source/core/ole/ndole.cxx |    8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit ff597693035d0f60dc53f884e3c456b1048d92ab
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jun 28 14:07:14 2018 +0200

    loplugin:useuniqueptr in SwOLEObj
    
    Change-Id: I36b14c31bfdf66b158dd2cf8f6a7a125d52cddb5
    Reviewed-on: https://gerrit.libreoffice.org/56627
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index cc72ff6279a3..f77f70905a32 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -46,7 +46,7 @@ class SW_DLLPUBLIC SwOLEObj
     // eventually buffered data if it is a chart OLE
     drawinglayer::primitive2d::Primitive2DContainer     m_aPrimitive2DSequence;
     basegfx::B2DRange                                   m_aRange;
-    DeflateData*                                  m_pDeflateData;
+    std::unique_ptr<DeflateData>                        m_pDeflateData;
 
     SwOLEObj( const SwOLEObj& rObj ) = delete;
 
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 755410d33bc9..6101302bf40b 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -1019,8 +1019,7 @@ drawinglayer::primitive2d::Primitive2DContainer const & SwOLEObj::tryToGetChartC
             // copy the result data and cleanup
             m_aPrimitive2DSequence = m_pDeflateData->getSequence();
             m_aRange = m_pDeflateData->getRange();
-            delete m_pDeflateData;
-            m_pDeflateData = nullptr;
+            m_pDeflateData.reset();
         }
     }
 
@@ -1048,7 +1047,7 @@ drawinglayer::primitive2d::Primitive2DContainer const & SwOLEObj::tryToGetChartC
                 // is okay (preview will be reused)
                 if(!m_pDeflateData)
                 {
-                    m_pDeflateData = new DeflateData(aXModel);
+                    m_pDeflateData.reset( new DeflateData(aXModel) );
                     DeflateThread* pNew = new DeflateThread(*m_pDeflateData);
                     comphelper::ThreadPool::getSharedOptimalPool().pushTask(pNew);
                 }
@@ -1074,8 +1073,7 @@ void SwOLEObj::resetBufferedData()
     {
         // load is in progress, wait until finished and cleanup without using it
         m_pDeflateData->waitFinished();
-        delete m_pDeflateData;
-        m_pDeflateData = nullptr;
+        m_pDeflateData.reset();
     }
 }
 


More information about the Libreoffice-commits mailing list