[Libreoffice-commits] core.git: vcl/unx

Noel Grandin noel.grandin at collabora.co.uk
Fri Feb 2 10:20:49 UTC 2018


 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx |    7 +++----
 vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx |    4 +---
 2 files changed, 4 insertions(+), 7 deletions(-)

New commits:
commit e91aa231ee934b2f18b387f37a6e9017b05f2256
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 29 09:39:15 2018 +0200

    loplugin:useuniqueptr in SalGtkFilePicker
    
    Change-Id: I3cbe4121c1cb323ad00e110bcdb1f61334e656bc
    Reviewed-on: https://gerrit.libreoffice.org/49131
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index dfc5274bbb63..95524567d898 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -82,7 +82,6 @@ void SalGtkFilePicker::InitialMapping()
 SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext >& xContext ) :
     SalGtkPicker( xContext ),
     SalGtkFilePicker_Base( m_rbHelperMtx ),
-    m_pFilterVector( nullptr ),
     m_pParentWidget ( nullptr ),
     m_pVBox ( nullptr ),
     mnHID_FolderChange( 0 ),
@@ -525,7 +524,7 @@ void SalGtkFilePicker::ensureFilterVector( const OUString& _rInitialCurrentFilte
 {
     if( !m_pFilterVector )
     {
-        m_pFilterVector = new FilterVector;
+        m_pFilterVector.reset( new std::vector<FilterEntry> );
 
         // set the first filter to the current filter
         if ( m_aCurrentFilter.isEmpty() )
@@ -810,7 +809,7 @@ uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles()
 
             if (m_pFilterVector)
             {
-                FilterVector::iterator aVectorIter = ::std::find_if(
+                auto aVectorIter = ::std::find_if(
                     m_pFilterVector->begin(), m_pFilterVector->end(), FilterTitleMatch(sFilterName) );
 
                 OUString aFilter;
@@ -1969,7 +1968,7 @@ SalGtkFilePicker::~SalGtkFilePicker()
         gtk_widget_destroy( m_pHBoxs[i] );
     }
 
-    delete m_pFilterVector;
+    m_pFilterVector.reset();
 
     gtk_widget_destroy( m_pVBox );
 }
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
index 8de4131f4778..bac8395a5359 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
@@ -38,8 +38,6 @@
 struct FilterEntry;
 struct ElementEntry_Impl;
 
-typedef ::std::vector < FilterEntry >     FilterVector;
-
 // class declaration
 
 typedef cppu::WeakComponentImplHelper<
@@ -150,7 +148,7 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base
         css::uno::Reference< css::ui::dialogs::XFilePickerListener >
             m_xListener;
         OUString msPlayLabel;
-        FilterVector *m_pFilterVector;
+        std::unique_ptr<std::vector<FilterEntry>> m_pFilterVector;
         GtkWidget  *m_pParentWidget;
         GtkWidget  *m_pVBox;
         GtkWidget  *m_pFilterExpander;


More information about the Libreoffice-commits mailing list