diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-14 10:02:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-15 08:41:46 +0200 |
commit | aad3b3b067987390b356a6901b85e0bfab46fab8 (patch) | |
tree | 284f601b50233911b5f291d84565115544412218 /cui/source | |
parent | 13ec3a1d80df070fff0227b089c4e9d29d7f06cc (diff) |
loplugin:useuniqueptr in IconChoiceDialog
Change-Id: I3c39782cdbb332627e33ecb85c8d447a40ea0fea
Reviewed-on: https://gerrit.libreoffice.org/59026
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/iconcdlg.cxx | 14 | ||||
-rw-r--r-- | cui/source/inc/iconcdlg.hxx | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index bb9b8eadcb97..969bf03cdf36 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -198,11 +198,10 @@ void IconChoiceDialog::dispose() //aTabDlgOpt.SetWindowState(OStringToOUString(GetWindowState((WindowStateMask::X | WindowStateMask::Y | WindowStateMask::State | WindowStateMask::Minimized)), RTL_TEXTENCODING_ASCII_US)); //aTabDlgOpt.SetPageID( mnCurrentPageId ); - for (IconChoicePageData* pData : maPageList) + for (std::unique_ptr<IconChoicePageData> & pData : maPageList) { if ( pData->pPage ) pData->pPage.disposeAndClear(); - delete pData; } maPageList.clear(); @@ -232,8 +231,7 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( CreatePage pCreateFunc /* != 0 */ ) { - IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc ); - maPageList.push_back( pData ); + maPageList.emplace_back( new IconChoicePageData ( nId, pCreateFunc ) ); SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->InsertEntry( rIconText, rChoiceIcon ); pEntry->SetUserData ( reinterpret_cast<void*>(nId) ); @@ -431,7 +429,7 @@ void IconChoiceDialog::DeActivatePageImpl () { // TODO refresh input set // flag all pages to be newly initialized - for (IconChoicePageData* pObj : maPageList) + for (auto & pObj : maPageList) { if ( pObj->pPage.get() != pPage ) pObj->bRefresh = true; @@ -540,7 +538,7 @@ void IconChoiceDialog::Start() bool IconChoiceDialog::QueryClose() { bool bRet = true; - for (IconChoicePageData* pData : maPageList) + for (auto & pData : maPageList) { if ( pData->pPage && !pData->pPage->QueryClose() ) { @@ -566,11 +564,11 @@ void IconChoiceDialog::Start_Impl() IconChoicePageData* IconChoiceDialog::GetPageData ( HyperLinkPageType nId ) { IconChoicePageData *pRet = nullptr; - for (IconChoicePageData* pData : maPageList) + for (auto & pData : maPageList) { if ( pData->nId == nId ) { - pRet = pData; + pRet = pData.get(); break; } } diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx index d72edc06b5a0..7f13cbfe40e1 100644 --- a/cui/source/inc/iconcdlg.hxx +++ b/cui/source/inc/iconcdlg.hxx @@ -96,7 +96,7 @@ class IconChoiceDialog : public SfxModalDialog private: friend class IconChoicePage; - std::vector< IconChoicePageData* > maPageList; + std::vector< std::unique_ptr<IconChoicePageData> > maPageList; VclPtr<SvtIconChoiceCtrl> m_pIconCtrl; |