sfx2/source/dialog/versdlg.cxx | 25 +++++++++++-------------- sfx2/source/inc/versdlg.hxx | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-)
New commits: commit 619027af4480e71198ab7c642f9b56c618c1fba3 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu May 3 14:10:22 2018 +0200 loplugin:useuniqueptr in SfxCmisVersionsDialog Change-Id: Ib2ad8550fa452478066039d79a75f75cb5605460 Reviewed-on: https://gerrit.libreoffice.org/53870 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index f268bfeef031..1624304bd20b 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -544,7 +544,7 @@ SfxCmisVersionsDialog::~SfxCmisVersionsDialog() void SfxCmisVersionsDialog::dispose() { - delete m_pTable; + m_pTable.reset(); m_pVersionBox.disposeAndClear(); m_pOpenButton.clear(); m_pViewButton.clear(); @@ -557,20 +557,17 @@ void SfxCmisVersionsDialog::LoadVersions() { SfxObjectShell *pObjShell = pViewFrame->GetObjectShell(); uno::Sequence < document::CmisVersion > aVersions = pObjShell->GetCmisVersions( ); - delete m_pTable; - m_pTable = new SfxVersionTableDtor( aVersions ); + m_pTable.reset(new SfxVersionTableDtor( aVersions )); + for ( size_t n = 0; n < m_pTable->size(); ++n ) { - for ( size_t n = 0; n < m_pTable->size(); ++n ) - { - SfxVersionInfo *pInfo = m_pTable->at( n ); - OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper()); - aEntry += "\t"; - aEntry += pInfo->aAuthor; - aEntry += "\t"; - aEntry += ConvertWhiteSpaces_Impl( pInfo->aComment ); - SvTreeListEntry *pEntry = m_pVersionBox->InsertEntry( aEntry ); - pEntry->SetUserData( pInfo ); - } + SfxVersionInfo *pInfo = m_pTable->at( n ); + OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper()); + aEntry += "\t"; + aEntry += pInfo->aAuthor; + aEntry += "\t"; + aEntry += ConvertWhiteSpaces_Impl( pInfo->aComment ); + SvTreeListEntry *pEntry = m_pVersionBox->InsertEntry( aEntry ); + pEntry->SetUserData( pInfo ); } } diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx index b35d3fa36b9d..fa687f3c81f1 100644 --- a/sfx2/source/inc/versdlg.hxx +++ b/sfx2/source/inc/versdlg.hxx @@ -97,7 +97,7 @@ class SfxCmisVersionsDialog : public SfxModalDialog VclPtr<PushButton> m_pDeleteButton; VclPtr<PushButton> m_pCompareButton; SfxViewFrame* pViewFrame; - SfxVersionTableDtor* m_pTable; + std::unique_ptr<SfxVersionTableDtor> m_pTable; void LoadVersions(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits