diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-22 13:25:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-23 09:31:20 +0200 |
commit | d1e47b1428abf1732ab4d5e219b210760d4152e0 (patch) | |
tree | 8eac1def834ba548c45a8a1a18e8e39d45eedc1d /sw/source/core | |
parent | 919a4ef592b6026a7533a93682f39118fef29ce8 (diff) |
enhance useuniqueptr loplugin
teach it to look for the following sequence in a destructor:
delete m_pfoo;
m_pfoo = nullptr;
Change-Id: Icd6271a63a024e32b53cc9e599f8f59952160380
Reviewed-on: https://gerrit.libreoffice.org/37900
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/doc/DocumentLayoutManager.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentListItemsManager.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentLayoutManager.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentListItemsManager.hxx | 3 |
4 files changed, 7 insertions, 10 deletions
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index 7c3589a156dd..c54947739ddb 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -90,17 +90,17 @@ bool DocumentLayoutManager::HasLayout() const SwLayouter* DocumentLayoutManager::GetLayouter() { - return mpLayouter; + return mpLayouter.get(); } const SwLayouter* DocumentLayoutManager::GetLayouter() const { - return mpLayouter; + return mpLayouter.get(); } void DocumentLayoutManager::SetLayouter( SwLayouter* pNew ) { - mpLayouter = pNew; + mpLayouter.reset( pNew ); } /** Create a new format whose settings fit to the Request by default. @@ -508,8 +508,6 @@ void DocumentLayoutManager::ClearSwLayouterEntries() DocumentLayoutManager::~DocumentLayoutManager() { - delete mpLayouter; - mpLayouter = nullptr; } } diff --git a/sw/source/core/doc/DocumentListItemsManager.cxx b/sw/source/core/doc/DocumentListItemsManager.cxx index 43c05b8716b2..adbdeec36088 100644 --- a/sw/source/core/doc/DocumentListItemsManager.cxx +++ b/sw/source/core/doc/DocumentListItemsManager.cxx @@ -94,9 +94,6 @@ void DocumentListItemsManager::getNumItems( tSortedNodeNumList& orNodeNumList ) DocumentListItemsManager::~DocumentListItemsManager() { -// #i83479# -delete mpListItemsList; -mpListItemsList = nullptr; } diff --git a/sw/source/core/inc/DocumentLayoutManager.hxx b/sw/source/core/inc/DocumentLayoutManager.hxx index 780ca1ff988e..c9813dbf819a 100644 --- a/sw/source/core/inc/DocumentLayoutManager.hxx +++ b/sw/source/core/inc/DocumentLayoutManager.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTLAYOUTMANAGER_HXX #include <IDocumentLayoutAccess.hxx> +#include <memory> class SwDoc; class SwViewShell; @@ -64,7 +65,7 @@ private: SwDoc& m_rDoc; SwViewShell *mpCurrentView; //< SwDoc should get a new member mpCurrentView - SwLayouter *mpLayouter; /**< css::frame::Controller for complex layout formatting + std::unique_ptr<SwLayouter> mpLayouter; /**< css::frame::Controller for complex layout formatting like footnote/endnote in sections */ }; diff --git a/sw/source/core/inc/DocumentListItemsManager.hxx b/sw/source/core/inc/DocumentListItemsManager.hxx index b4b3d3dc15d1..36e56e015d7a 100644 --- a/sw/source/core/inc/DocumentListItemsManager.hxx +++ b/sw/source/core/inc/DocumentListItemsManager.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTLISTITEMSMANAGER_HXX #include <IDocumentListItems.hxx> +#include <memory> #include <set> namespace sw @@ -56,7 +57,7 @@ private: DocumentListItemsManager(DocumentListItemsManager const&) = delete; DocumentListItemsManager& operator=(DocumentListItemsManager const&) = delete; - tImplSortedNodeNumList* mpListItemsList; + std::unique_ptr<tImplSortedNodeNumList> mpListItemsList; }; } |