sw/source/core/access/parachangetrackinginfo.cxx | 35 +++++++++-------------- sw/source/core/access/parachangetrackinginfo.hxx | 7 ++-- 2 files changed, 19 insertions(+), 23 deletions(-)
New commits: commit 43bc1b5c92b7415ec90eb9807c105508b2e35ccc Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Jun 20 17:07:11 2018 +0200 loplugin:useuniqueptr in SwParaChangeTrackingInfo Change-Id: I4c1f3251febbf5b11fe41f8af5faa6385f54a1f2 Reviewed-on: https://gerrit.libreoffice.org/56201 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx index 37686bc4e9b1..b7ce109db39d 100644 --- a/sw/source/core/access/parachangetrackinginfo.cxx +++ b/sw/source/core/access/parachangetrackinginfo.cxx @@ -33,13 +33,13 @@ namespace { void initChangeTrackTextMarkupLists( const SwTextFrame& rTextFrame, - SwWrongList*& opChangeTrackInsertionTextMarkupList, - SwWrongList*& opChangeTrackDeletionTextMarkupList, - SwWrongList*& opChangeTrackFormatChangeTextMarkupList ) + std::unique_ptr<SwWrongList>& opChangeTrackInsertionTextMarkupList, + std::unique_ptr<SwWrongList>& opChangeTrackDeletionTextMarkupList, + std::unique_ptr<SwWrongList>& opChangeTrackFormatChangeTextMarkupList ) { - opChangeTrackInsertionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING ); - opChangeTrackDeletionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING ); - opChangeTrackFormatChangeTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING ); + opChangeTrackInsertionTextMarkupList.reset( new SwWrongList( WRONGLIST_CHANGETRACKING ) ); + opChangeTrackDeletionTextMarkupList.reset( new SwWrongList( WRONGLIST_CHANGETRACKING ) ); + opChangeTrackFormatChangeTextMarkupList.reset( new SwWrongList( WRONGLIST_CHANGETRACKING ) ); if (!rTextFrame.GetTextNodeFirst()) { @@ -107,17 +107,17 @@ namespace { { case nsRedlineType_t::REDLINE_INSERT: { - pMarkupList = opChangeTrackInsertionTextMarkupList; + pMarkupList = opChangeTrackInsertionTextMarkupList.get(); } break; case nsRedlineType_t::REDLINE_DELETE: { - pMarkupList = opChangeTrackDeletionTextMarkupList; + pMarkupList = opChangeTrackDeletionTextMarkupList.get(); } break; case nsRedlineType_t::REDLINE_FORMAT: { - pMarkupList = opChangeTrackFormatChangeTextMarkupList; + pMarkupList = opChangeTrackFormatChangeTextMarkupList.get(); } break; default: @@ -157,14 +157,9 @@ SwParaChangeTrackingInfo::~SwParaChangeTrackingInfo() void SwParaChangeTrackingInfo::reset() { - delete mpChangeTrackInsertionTextMarkupList; - mpChangeTrackInsertionTextMarkupList = nullptr; - - delete mpChangeTrackDeletionTextMarkupList; - mpChangeTrackDeletionTextMarkupList = nullptr; - - delete mpChangeTrackFormatChangeTextMarkupList; - mpChangeTrackFormatChangeTextMarkupList = nullptr; + mpChangeTrackInsertionTextMarkupList.reset(); + mpChangeTrackDeletionTextMarkupList.reset(); + mpChangeTrackFormatChangeTextMarkupList.reset(); } const SwWrongList* SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList( const sal_Int32 nTextMarkupType ) @@ -187,17 +182,17 @@ const SwWrongList* SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList( co { case css::text::TextMarkupType::TRACK_CHANGE_INSERTION: { - pChangeTrackingTextMarkupList = mpChangeTrackInsertionTextMarkupList; + pChangeTrackingTextMarkupList = mpChangeTrackInsertionTextMarkupList.get(); } break; case css::text::TextMarkupType::TRACK_CHANGE_DELETION: { - pChangeTrackingTextMarkupList = mpChangeTrackDeletionTextMarkupList; + pChangeTrackingTextMarkupList = mpChangeTrackDeletionTextMarkupList.get(); } break; case css::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE: { - pChangeTrackingTextMarkupList = mpChangeTrackFormatChangeTextMarkupList; + pChangeTrackingTextMarkupList = mpChangeTrackFormatChangeTextMarkupList.get(); } break; default: diff --git a/sw/source/core/access/parachangetrackinginfo.hxx b/sw/source/core/access/parachangetrackinginfo.hxx index 4a83beedc5d5..30f020125b33 100644 --- a/sw/source/core/access/parachangetrackinginfo.hxx +++ b/sw/source/core/access/parachangetrackinginfo.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_SOURCE_CORE_ACCESS_PARACHANGETRACKINGINFO_HXX #include <sal/types.h> +#include <memory> class SwTextFrame; class SwWrongList; @@ -41,9 +42,9 @@ class SwParaChangeTrackingInfo const SwTextFrame& mrTextFrame; - SwWrongList* mpChangeTrackInsertionTextMarkupList; - SwWrongList* mpChangeTrackDeletionTextMarkupList; - SwWrongList* mpChangeTrackFormatChangeTextMarkupList; + std::unique_ptr<SwWrongList> mpChangeTrackInsertionTextMarkupList; + std::unique_ptr<SwWrongList> mpChangeTrackDeletionTextMarkupList; + std::unique_ptr<SwWrongList> mpChangeTrackFormatChangeTextMarkupList; }; #endif _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits