diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-03 14:08:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-07 08:31:40 +0200 |
commit | 063ac5c39a8ba324ca14384065df1118e44fabd5 (patch) | |
tree | 0daceb11b10d694ffc11fe645424f1b90b975c11 | |
parent | 8ffd83de107adfcc7a18bde6e8337c90924b89b7 (diff) |
loplugin:useuniqueptr in SfxVersionDialog
Change-Id: I6adb8baff9792c65e3474c10e6ffdac56fe2e5ff
Reviewed-on: https://gerrit.libreoffice.org/53869
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sfx2/source/dialog/versdlg.cxx | 25 | ||||
-rw-r--r-- | sfx2/source/inc/versdlg.hxx | 2 |
2 files changed, 12 insertions, 15 deletions
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index ff3dcb81ef6b..f268bfeef031 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -270,20 +270,17 @@ void SfxVersionDialog::Init_Impl() SfxObjectShell *pObjShell = pViewFrame->GetObjectShell(); SfxMedium* pMedium = pObjShell->GetMedium(); uno::Sequence < util::RevisionTag > aVersions = pMedium->GetVersionList( true ); - 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 ); } m_pSaveCheckBox->Check( m_bIsSaveVersionOnClose ); @@ -312,7 +309,7 @@ SfxVersionDialog::~SfxVersionDialog() void SfxVersionDialog::dispose() { - delete m_pTable; + m_pTable.reset(); m_pVersionBox.disposeAndClear(); m_pSaveButton.clear(); m_pSaveCheckBox.clear(); diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx index 4d81c139a1e9..b35d3fa36b9d 100644 --- a/sfx2/source/inc/versdlg.hxx +++ b/sfx2/source/inc/versdlg.hxx @@ -55,7 +55,7 @@ class SfxVersionDialog : public SfxModalDialog VclPtr<PushButton> m_pCompareButton; VclPtr<PushButton> m_pCmisButton; SfxViewFrame* pViewFrame; - SfxVersionTableDtor* m_pTable; + std::unique_ptr<SfxVersionTableDtor> m_pTable; bool m_bIsSaveVersionOnClose; DECL_LINK( DClickHdl_Impl, SvTreeListBox*, bool); |