From 979293ca138ccfb22ff1282b9055ae18b775fed8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 24 Apr 2018 13:42:15 +0200 Subject: loplugin:useuniqueptr in FontNameBox Change-Id: Icb362d46b34010dbfc97014d76a364b720c73b02 Reviewed-on: https://gerrit.libreoffice.org/53595 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/svtools/ctrlbox.hxx | 2 +- svtools/source/control/ctrlbox.cxx | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index 5e557e24777f..bb080249fa42 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -283,7 +283,7 @@ inline void LineListBox::SetNone( const OUString& sNone ) class SVT_DLLPUBLIC FontNameBox : public ComboBox { private: - ImplFontList* mpFontList; + std::unique_ptr mpFontList; bool mbWYSIWYG; OUString maFontMRUEntriesFile; diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 82cd893e9710..5704f3e9d977 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -669,7 +669,6 @@ void LineListBox::DataChanged( const DataChangedEvent& rDCEvt ) FontNameBox::FontNameBox( vcl::Window* pParent, WinBits nWinStyle ) : ComboBox( pParent, nWinStyle ) { - mpFontList = nullptr; mbWYSIWYG = false; InitFontMRUEntriesFile(); } @@ -759,8 +758,7 @@ void FontNameBox::InitFontMRUEntriesFile() void FontNameBox::ImplDestroyFontList() { - delete mpFontList; - mpFontList = nullptr; + mpFontList.reset(); } void FontNameBox::Fill( const FontList* pList ) @@ -772,7 +770,7 @@ void FontNameBox::Fill( const FontList* pList ) Clear(); ImplDestroyFontList(); - mpFontList = new ImplFontList; + mpFontList.reset(new ImplFontList); // insert fonts sal_uInt16 nFontCount = pList->GetFontNameCount(); -- cgit