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 /vcl/source/control/field2.cxx | |
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 'vcl/source/control/field2.cxx')
-rw-r--r-- | vcl/source/control/field2.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index dc36c0526735..ac9bb2b16305 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -1426,14 +1426,11 @@ DateFormatter::DateFormatter() : DateFormatter::~DateFormatter() { - delete mpCalendarWrapper; - mpCalendarWrapper = nullptr; } void DateFormatter::SetLocale( const css::lang::Locale& rLocale ) { - delete mpCalendarWrapper; - mpCalendarWrapper = nullptr; + mpCalendarWrapper.reset(); FormatterBase::SetLocale( rLocale ); } @@ -1441,7 +1438,7 @@ CalendarWrapper& DateFormatter::GetCalendarWrapper() const { if ( !mpCalendarWrapper ) { - const_cast<DateFormatter*>(this)->mpCalendarWrapper = new CalendarWrapper( comphelper::getProcessComponentContext() ); + const_cast<DateFormatter*>(this)->mpCalendarWrapper.reset( new CalendarWrapper( comphelper::getProcessComponentContext() ) ); mpCalendarWrapper->loadDefaultCalendar( GetLocale() ); } |