diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-23 12:21:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-26 11:16:01 +0200 |
commit | 939b90f12684d3c6c394b182e9c134bb9150ab24 (patch) | |
tree | 6df68e4d2f30dc5af5b0e30444d02dd95c426fb9 | |
parent | fc3e31ff8eaff7385e200f82972c4e5eb9055723 (diff) |
loplugin:useuniqueptr in ScChartListener
Change-Id: Ib178b1cbe518088af7b3120c5188dd03ae4cf6c2
Reviewed-on: https://gerrit.libreoffice.org/51848
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/inc/chartlis.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/chartlis.cxx | 10 |
2 files changed, 4 insertions, 8 deletions
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 |