From 77a015f160d544827d298fd42b16418ace6a43c0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 12 Jul 2018 16:40:47 +0200 Subject: loplugin:useuniqueptr in ScInsertTableDlg Change-Id: I239d3b1b585219125841dcc02104390f4a1ac3b7 Reviewed-on: https://gerrit.libreoffice.org/57362 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/ui/inc/instbdlg.hxx | 2 +- sc/source/ui/miscdlgs/instbdlg.cxx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx index 7e8e2b29eee9..8a80e7183035 100644 --- a/sc/source/ui/inc/instbdlg.hxx +++ b/sc/source/ui/inc/instbdlg.hxx @@ -53,7 +53,7 @@ private: ScViewData& rViewData; ScDocument& rDoc; ScDocShell* pDocShTables; - sfx2::DocumentInserter* pDocInserter; + std::unique_ptr pDocInserter; SfxObjectShellRef aDocShTablesRef; bool bMustClose; diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index 3b6269622599..1c27d79e9398 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -66,7 +66,7 @@ ScInsertTableDlg::~ScInsertTableDlg() { if (pDocShTables) pDocShTables->DoClose(); - delete pDocInserter; + pDocInserter.reset(); } void ScInsertTableDlg::Init_Impl( bool bFromFile ) @@ -262,8 +262,8 @@ IMPL_LINK_NOARG(ScInsertTableDlg, ChoiceHdl_Impl, weld::Button&, void) IMPL_LINK_NOARG(ScInsertTableDlg, BrowseHdl_Impl, weld::Button&, void) { - delete pDocInserter; - pDocInserter = new ::sfx2::DocumentInserter(m_xDialog.get(), ScDocShell::Factory().GetFactoryName()); + pDocInserter.reset(); + pDocInserter.reset( new ::sfx2::DocumentInserter(m_xDialog.get(), ScDocShell::Factory().GetFactoryName()) ); pDocInserter->StartExecuteModal( LINK( this, ScInsertTableDlg, DialogClosedHdl ) ); } -- cgit