[Libreoffice-commits] core.git: 2 commits - sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Jul 30 06:22:30 UTC 2018
sw/source/ui/dbui/createaddresslistdialog.cxx | 5 ++---
sw/source/ui/dbui/createaddresslistdialog.hxx | 2 +-
sw/source/ui/dbui/customizeaddresslistdialog.hxx | 4 ++--
sw/source/ui/misc/titlepage.cxx | 9 +++------
sw/source/uibase/inc/titlepage.hxx | 2 +-
5 files changed, 9 insertions(+), 13 deletions(-)
New commits:
commit 15e7509e6781957bc82bc7ce7d0619179b126256
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 27 09:35:03 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 08:22:16 2018 +0200
loplugin:useuniqueptr in SwCreateAddressListDialog
Change-Id: I4d118e6f4db66beb3553eeead2a36cbb8bec45be
Reviewed-on: https://gerrit.libreoffice.org/58246
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx
index a43be61db108..0e3d04664e5a 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.cxx
@@ -497,7 +497,7 @@ SwCreateAddressListDialog::~SwCreateAddressListDialog()
void SwCreateAddressListDialog::dispose()
{
- delete m_pCSVData;
+ m_pCSVData.reset();
m_pAddressControl.clear();
m_pNewPB.clear();
m_pDeletePB.clear();
@@ -570,8 +570,7 @@ IMPL_LINK(SwCreateAddressListDialog, CustomizeHdl_Impl, Button*, pButton, void)
VclPtrInstance< SwCustomizeAddressListDialog > pDlg(pButton, *m_pCSVData);
if(RET_OK == pDlg->Execute())
{
- delete m_pCSVData;
- m_pCSVData = pDlg->GetNewData();
+ m_pCSVData = pDlg->ReleaseNewData();
m_pAddressControl->SetData(*m_pCSVData);
m_pAddressControl->SetCurrentDataSet(m_pAddressControl->GetCurrentDataSet());
}
diff --git a/sw/source/ui/dbui/createaddresslistdialog.hxx b/sw/source/ui/dbui/createaddresslistdialog.hxx
index 81ecad7cb8ec..8961898dcb0d 100644
--- a/sw/source/ui/dbui/createaddresslistdialog.hxx
+++ b/sw/source/ui/dbui/createaddresslistdialog.hxx
@@ -59,7 +59,7 @@ class SwCreateAddressListDialog : public SfxModalDialog
OUString m_sAddressListFilterName;
OUString m_sURL;
- SwCSVData* m_pCSVData;
+ std::unique_ptr<SwCSVData> m_pCSVData;
VclPtr<SwFindEntryDialog> m_pFindDlg;
DECL_LINK(NewHdl_Impl, Button*, void);
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
index aaf120f71c4f..a138d83ddf94 100644
--- a/sw/source/ui/dbui/customizeaddresslistdialog.hxx
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
@@ -37,7 +37,7 @@ class SwCustomizeAddressListDialog : public SfxModalDialog
VclPtr<PushButton> m_pUpPB;
VclPtr<PushButton> m_pDownPB;
- SwCSVData* m_pNewData;
+ std::unique_ptr<SwCSVData> m_pNewData;
DECL_LINK(AddRenameHdl_Impl, Button*, void);
DECL_LINK(DeleteHdl_Impl, Button*, void);
@@ -50,7 +50,7 @@ public:
virtual ~SwCustomizeAddressListDialog() override;
virtual void dispose() override;
- SwCSVData* GetNewData() { return m_pNewData;}
+ std::unique_ptr<SwCSVData> ReleaseNewData() { return std::move(m_pNewData);}
};
class SwAddRenameEntryDialog : public SfxModalDialog
commit 951cf8e6cf2d5e5fc2c3c760ef5df2cadb04aea4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 27 09:31:48 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 30 08:22:07 2018 +0200
loplugin:useuniqueptr in SwTitlePageDlg
Change-Id: I8e68950b311e78dd7bb71d282728a92f98bcccbb
Reviewed-on: https://gerrit.libreoffice.org/58245
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx
index 36034678463b..7415b6be78c3 100644
--- a/sw/source/ui/misc/titlepage.cxx
+++ b/sw/source/ui/misc/titlepage.cxx
@@ -28,7 +28,7 @@
namespace
{
- bool lcl_GetPageDesc(SwWrtShell *pSh, sal_uInt16 &rPageNo, const SwFormatPageDesc **ppPageFormatDesc)
+ bool lcl_GetPageDesc(SwWrtShell *pSh, sal_uInt16 &rPageNo, std::unique_ptr<const SwFormatPageDesc>* ppPageFormatDesc)
{
bool bRet = false;
SfxItemSet aSet( pSh->GetAttrPool(), svl::Items<RES_PAGEDESC, RES_PAGEDESC>{} );
@@ -41,7 +41,7 @@ namespace
if (oNumOffset)
rPageNo = oNumOffset.get();
if (ppPageFormatDesc)
- (*ppPageFormatDesc) = static_cast<const SwFormatPageDesc *>(pItem->Clone());
+ ppPageFormatDesc->reset(static_cast<const SwFormatPageDesc *>(pItem->Clone()));
bRet = true;
}
}
@@ -54,7 +54,7 @@ namespace
const size_t nCurIdx = pSh->GetCurPageDesc();
const SwPageDesc &rCurrentDesc = pSh->GetPageDesc( nCurIdx );
- const SwFormatPageDesc *pPageFormatDesc(nullptr);
+ std::unique_ptr<const SwFormatPageDesc> pPageFormatDesc;
sal_uInt16 nDontCare;
lcl_GetPageDesc(pSh, nDontCare, &pPageFormatDesc);
@@ -97,8 +97,6 @@ namespace
if (nPgNo) aPageFormatDesc.SetNumOffset(nPgNo);
pSh->SetAttrItem(aPageFormatDesc);
}
-
- delete pPageFormatDesc;
}
void lcl_PushCursor(SwWrtShell *pSh)
@@ -256,7 +254,6 @@ IMPL_LINK_NOARG(SwTitlePageDlg, StartPageHdl, weld::ToggleButton&, void)
SwTitlePageDlg::~SwTitlePageDlg()
{
- delete mpPageFormatDesc;
}
IMPL_LINK_NOARG(SwTitlePageDlg, EditHdl, weld::Button&, void)
diff --git a/sw/source/uibase/inc/titlepage.hxx b/sw/source/uibase/inc/titlepage.hxx
index 836d1d7dc0c5..1a05faf25365 100644
--- a/sw/source/uibase/inc/titlepage.hxx
+++ b/sw/source/uibase/inc/titlepage.hxx
@@ -21,7 +21,7 @@ class SwTitlePageDlg : public weld::GenericDialogController
private:
SwWrtShell *mpSh;
- const SwFormatPageDesc *mpPageFormatDesc;
+ std::unique_ptr<const SwFormatPageDesc> mpPageFormatDesc;
SwPageDesc *mpTitleDesc;
const SwPageDesc *mpIndexDesc;
More information about the Libreoffice-commits
mailing list