[Libreoffice-commits] core.git: sfx2/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed May 2 07:21:20 UTC 2018
sfx2/source/appl/shutdownicon.cxx | 13 +++++--------
sfx2/source/appl/shutdownicon.hxx | 3 ++-
2 files changed, 7 insertions(+), 9 deletions(-)
New commits:
commit cfef1b48fd1307833a55aaea3eebbef5ed55e321
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Apr 30 08:47:51 2018 +0200
loplugin:useuniqueptr in ShutdownIcon
Change-Id: I7ccc31ff9cfdca7229b2acf00ebd35c98560a4e9
Reviewed-on: https://gerrit.libreoffice.org/53701
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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
More information about the Libreoffice-commits
mailing list