diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-30 08:47:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-02 09:20:58 +0200 |
commit | cfef1b48fd1307833a55aaea3eebbef5ed55e321 (patch) | |
tree | 2a11a0bf75afc3920b765e6ced97833057eb22b4 /sfx2 | |
parent | 2bba6d49fefd2f58b1771baee5786e1c49883b5c (diff) |
loplugin:useuniqueptr in ShutdownIcon
Change-Id: I7ccc31ff9cfdca7229b2acf00ebd35c98560a4e9
Reviewed-on: https://gerrit.libreoffice.org/53701
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.hxx | 3 |
2 files changed, 7 insertions, 9 deletions
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 44eaf5d510ad..0e9548dbcbec 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -195,8 +195,7 @@ void ShutdownIcon::deInitSystray() pInitSystray = nullptr; pDeInitSystray = nullptr; - delete m_pFileDlg; - m_pFileDlg = nullptr; + m_pFileDlg.reset(); m_bInitialized = false; } @@ -317,14 +316,13 @@ void ShutdownIcon::StartFileDialog() { // Destroy instance as changing the system file dialog setting // forces us to create a new FileDialogHelper instance! - delete m_pFileDlg; - m_pFileDlg = nullptr; + m_pFileDlg.reset(); } if ( !m_pFileDlg ) - m_pFileDlg = new FileDialogHelper( + m_pFileDlg.reset( new FileDialogHelper( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, - FileDialogFlags::MultiSelection, OUString(), SfxFilterFlags::NONE, SfxFilterFlags::NONE, nullptr ); + FileDialogFlags::MultiSelection, OUString(), SfxFilterFlags::NONE, SfxFilterFlags::NONE, nullptr ) ); m_pFileDlg->StartExecuteModal( LINK( this, ShutdownIcon, DialogClosedHdl_Impl ) ); } @@ -458,8 +456,7 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo // the settings. if ( SvtMiscOptions().UseSystemFileDialog() ) { - delete m_pFileDlg; - m_pFileDlg = nullptr; + m_pFileDlg.reset(); } #endif diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index 31baf75fbfc7..eafeb9e25149 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -33,6 +33,7 @@ #include <cppuhelper/compbase.hxx> #include <sfx2/dllapi.h> #include <tools/link.hxx> +#include <memory> extern "C" { @@ -67,7 +68,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase bool m_bVeto; bool m_bListenForTermination; bool m_bSystemDialogs; - sfx2::FileDialogHelper* m_pFileDlg; + std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg; css::uno::Reference< css::uno::XComponentContext > m_xContext; static ShutdownIcon *pShutdownIcon; // one instance |