diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-11 15:07:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-20 09:46:22 +0200 |
commit | c116f3c5b3dc30650d9109d34187e439d2489654 (patch) | |
tree | f37a00c32d769408438dcac0acd82b8364d468dd | |
parent | 71198fe7d9539859883b6226738fbea52a08a5c4 (diff) |
loplugin:useuniqueptr in IconChoiceDialog
Change-Id: I4a97cd8497056b48f8fb6439b2dc428887e0a0b9
Reviewed-on: https://gerrit.libreoffice.org/56098
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | cui/source/dialogs/iconcdlg.cxx | 11 | ||||
-rw-r--r-- | cui/source/inc/iconcdlg.hxx | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index 32800dab81d3..eccfd85a2fc2 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -205,8 +205,7 @@ void IconChoiceDialog::dispose() } maPageList.clear(); - delete pRanges; - pRanges = nullptr; + pRanges.reset(); pOutSet.reset(); m_pIconCtrl.clear(); @@ -467,7 +466,7 @@ const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool ) } if ( pRanges ) - return pRanges; + return pRanges.get(); std::vector<sal_uInt16> aUS; size_t nCount = maPageList.size(); @@ -484,11 +483,11 @@ const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool ) std::sort( aUS.begin(), aUS.end() ); } - pRanges = new sal_uInt16[aUS.size() + 1]; - std::copy( aUS.begin(), aUS.end(), pRanges ); + pRanges.reset(new sal_uInt16[aUS.size() + 1]); + std::copy( aUS.begin(), aUS.end(), pRanges.get() ); pRanges[aUS.size()] = 0; - return pRanges; + return pRanges.get(); } diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx index f65ebc645c34..d72edc06b5a0 100644 --- a/cui/source/inc/iconcdlg.hxx +++ b/cui/source/inc/iconcdlg.hxx @@ -113,7 +113,7 @@ private: const SfxItemSet* pSet; std::unique_ptr<SfxItemSet> pOutSet; SfxItemSet* pExampleSet; - sal_uInt16* pRanges; + std::unique_ptr<sal_uInt16[]> pRanges; DECL_LINK( ChosePageHdl_Impl, SvtIconChoiceCtrl*, void ); DECL_LINK( OkHdl, Button*, void ); |