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

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 26 09:16:22 UTC 2018


 sc/inc/chartlis.hxx              |    2 +-
 sc/source/core/tool/chartlis.cxx |   10 +++-------
 2 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 939b90f12684d3c6c394b182e9c134bb9150ab24
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Mar 23 12:21:17 2018 +0200

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

diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index 374e1aaeb20d..2537e15613d2 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -65,7 +65,7 @@ private:
     std::unique_ptr<std::vector<ScTokenRef> > mpTokens;
 
     OUString maName;
-    ScChartUnoData* pUnoData;
+    std::unique_ptr<ScChartUnoData> pUnoData;
     ScDocument*     mpDoc;
     bool            bUsed:1;  // for ScChartListenerCollection::FreeUnused
     bool            bDirty:1;
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index d11040b8944a..81b3c79dd9ed 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -96,7 +96,6 @@ ScChartListener::ScChartListener( const OUString& rName, ScDocument* pDocP,
     mpExtRefListener(nullptr),
     mpTokens(new vector<ScTokenRef>),
     maName(rName),
-    pUnoData( nullptr ),
     mpDoc( pDocP ),
     bUsed( false ),
     bDirty( false ),
@@ -110,7 +109,6 @@ ScChartListener::ScChartListener( const OUString& rName, ScDocument* pDocP, vect
     mpExtRefListener(nullptr),
     mpTokens(pTokens),
     maName(rName),
-    pUnoData( nullptr ),
     mpDoc( pDocP ),
     bUsed( false ),
     bDirty( false ),
@@ -123,14 +121,13 @@ ScChartListener::ScChartListener( const ScChartListener& r ) :
     mpExtRefListener(nullptr),
     mpTokens(new vector<ScTokenRef>(*r.mpTokens)),
     maName(r.maName),
-    pUnoData( nullptr ),
     mpDoc( r.mpDoc ),
     bUsed( false ),
     bDirty( r.bDirty ),
     bSeriesRangesScheduled( r.bSeriesRangesScheduled )
 {
     if ( r.pUnoData )
-        pUnoData = new ScChartUnoData( *r.pUnoData );
+        pUnoData.reset( new ScChartUnoData( *r.pUnoData ) );
 
     if (r.mpExtRefListener.get())
     {
@@ -153,7 +150,7 @@ ScChartListener::~ScChartListener()
 {
     if ( HasBroadcaster() )
         EndListeningTo();
-    delete pUnoData;
+    pUnoData.reset();
 
     if (mpExtRefListener.get())
     {
@@ -170,8 +167,7 @@ void ScChartListener::SetUno(
         const uno::Reference< chart::XChartDataChangeEventListener >& rListener,
         const uno::Reference< chart::XChartData >& rSource )
 {
-    delete pUnoData;
-    pUnoData = new ScChartUnoData( rListener, rSource );
+    pUnoData.reset( new ScChartUnoData( rListener, rSource ) );
 }
 
 uno::Reference< chart::XChartDataChangeEventListener > ScChartListener::GetUnoListener() const


More information about the Libreoffice-commits mailing list