[Libreoffice-commits] core.git: sfx2/source

Noel Grandin noel.grandin at collabora.co.uk
Mon May 7 06:32:13 UTC 2018


 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.grandin at 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 <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at 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();
 


More information about the Libreoffice-commits mailing list