[Libreoffice-commits] core.git: 2 commits - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jul 30 06:19:55 UTC 2018


 sw/source/ui/dialog/uiregionsw.cxx |    5 ++---
 sw/source/ui/envelp/envfmt.cxx     |   12 ++++++------
 sw/source/ui/envelp/envlop1.cxx    |    4 ++--
 sw/source/uibase/inc/envlop.hxx    |    4 ++--
 sw/source/uibase/inc/regionsw.hxx  |    2 +-
 5 files changed, 13 insertions(+), 14 deletions(-)

New commits:
commit c695c3ca47338fa28428ea507a44713c0f3616ba
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 26 15:16:51 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 08:19:44 2018 +0200

    loplugin:useuniqueptr in SwEditRegionDlg
    
    Change-Id: I59137a86744db372c9067a1b88b76654016a1823
    Reviewed-on: https://gerrit.libreoffice.org/58231
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 2a7a95027dac..a97185831b97 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -535,7 +535,7 @@ void SwEditRegionDlg::dispose()
         pEntry = m_pTree->Next( pEntry );
     }
 
-    delete m_pDocInserter;
+    m_pDocInserter.reset();
     m_pCurName.clear();
     m_pTree.clear();
     m_pFileCB.clear();
@@ -1040,8 +1040,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, FileSearchHdl, Button*, void)
 {
     if(!CheckPasswd())
         return;
-    delete m_pDocInserter;
-    m_pDocInserter = new ::sfx2::DocumentInserter(GetFrameWeld(), "swriter");
+    m_pDocInserter.reset(new ::sfx2::DocumentInserter(GetFrameWeld(), "swriter"));
     m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) );
 }
 
diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx
index 70f1e5b5e12c..7e9b9deaefb2 100644
--- a/sw/source/uibase/inc/regionsw.hxx
+++ b/sw/source/uibase/inc/regionsw.hxx
@@ -93,7 +93,7 @@ class SwEditRegionDlg : public SfxModalDialog
     SwWrtShell&             rSh;
     SectReprs_t             m_SectReprs;
     const SwSection*        pCurrSect;
-    sfx2::DocumentInserter* m_pDocInserter;
+    std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter;
 
     bool            bDontCheckPasswd :1;
 
commit 7fc64583c82f1ca545140fbde903a5cb19a97a06
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 26 15:15:20 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 08:19:33 2018 +0200

    loplugin:useuniqueptr in SwEnvDlg
    
    Change-Id: Ie907974dcdeb6f7f30801fc502d919afdab734f3
    Reviewed-on: https://gerrit.libreoffice.org/58230
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 98834e3d443c..f44b0c00f108 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -321,7 +321,7 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender)
 // A temporary Itemset that gets discarded at abort
 SfxItemSet *SwEnvFormatPage::GetCollItemSet(SwTextFormatColl const * pColl, bool bSender)
 {
-    SfxItemSet *&pAddrSet = bSender ? GetParentSwEnvDlg()->pSenderSet : GetParentSwEnvDlg()->pAddresseeSet;
+    std::unique_ptr<SfxItemSet>& pAddrSet = bSender ? GetParentSwEnvDlg()->pSenderSet : GetParentSwEnvDlg()->pAddresseeSet;
     if (!pAddrSet)
     {
         // determine range (merge both Itemsets' ranges)
@@ -346,12 +346,12 @@ SfxItemSet *SwEnvFormatPage::GetCollItemSet(SwTextFormatColl const * pColl, bool
         aVec2.insert(aVec2.end(), aVec.begin(), aVec.end());
         std::unique_ptr<sal_uInt16[]> pNewRanges(::lcl_convertListToRanges(aVec2));
 
-        pAddrSet = new SfxItemSet(GetParentSwEnvDlg()->pSh->GetView().GetCurShell()->GetPool(),
-                                  pNewRanges.get());
+        pAddrSet.reset(new SfxItemSet(GetParentSwEnvDlg()->pSh->GetView().GetCurShell()->GetPool(),
+                                  pNewRanges.get()));
         pAddrSet->Put(pColl->GetAttrSet());
     }
 
-    return pAddrSet;
+    return pAddrSet.get();
 }
 
 IMPL_LINK_NOARG(SwEnvFormatPage, FormatHdl, weld::ComboBoxText&, void)
@@ -484,8 +484,8 @@ void SwEnvFormatPage::Reset(const SfxItemSet* rSet)
     setfieldval(*m_xSizeHeightField , std::min(rItem.m_nWidth, rItem.m_nHeight));
     SetMinMax();
 
-    DELETEZ(GetParentSwEnvDlg()->pSenderSet);
-    DELETEZ(GetParentSwEnvDlg()->pAddresseeSet);
+    GetParentSwEnvDlg()->pSenderSet.reset();
+    GetParentSwEnvDlg()->pAddresseeSet.reset();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx
index 756a61a6465d..730351caeca3 100644
--- a/sw/source/ui/envelp/envlop1.cxx
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -141,8 +141,8 @@ SwEnvDlg::SwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet,
 
 SwEnvDlg::~SwEnvDlg()
 {
-    delete pAddresseeSet;
-    delete pSenderSet;
+    pAddresseeSet.reset();
+    pSenderSet.reset();
 }
 
 void SwEnvDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
diff --git a/sw/source/uibase/inc/envlop.hxx b/sw/source/uibase/inc/envlop.hxx
index 89ba397ed987..22a34fb997fa 100644
--- a/sw/source/uibase/inc/envlop.hxx
+++ b/sw/source/uibase/inc/envlop.hxx
@@ -73,8 +73,8 @@ friend class SwEnvPreview;
     SwEnvItem       aEnvItem;
     SwWrtShell      *pSh;
     VclPtr<Printer> pPrinter;
-    SfxItemSet      *pAddresseeSet;
-    SfxItemSet      *pSenderSet;
+    std::unique_ptr<SfxItemSet> pAddresseeSet;
+    std::unique_ptr<SfxItemSet> pSenderSet;
 
     std::unique_ptr<weld::Button> m_xModify;
 


More information about the Libreoffice-commits mailing list