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

Julien Nabet serval2412 at yahoo.fr
Thu Feb 1 20:47:05 UTC 2018


 vcl/unx/generic/dtrans/X11_selection.cxx |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 01cea287d8e0dc9c49738b00c93128534e149e75
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Thu Feb 1 14:17:24 2018 +0100

    Convert 2 lists in vectors in X11_selection (vcl)
    
    by replacing front/pop_front calls
    with use for-range loops with a call clear() afterwards
    
    Change-Id: I5eadebadca688dc2bb9818b67ca8b5f4ddb06acc
    Reviewed-on: https://gerrit.libreoffice.org/49089
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index ba5bdc1d8475..7096c0c59c8d 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -1900,7 +1900,7 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify
             bHandled = true;
             int nCurrentTime = time( nullptr );
             // throw out aborted transfers
-            std::list< Atom > aTimeouts;
+            std::vector< Atom > aTimeouts;
             for (auto const& incrementalTransfer : it->second)
             {
                 if( (nCurrentTime - incrementalTransfer.second.m_nTransferStartTime) > (getSelectionTimeout()+2) )
@@ -1917,13 +1917,13 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify
                 }
             }
 
-            while( !aTimeouts.empty() )
+            for (auto const& timeout : aTimeouts)
             {
                 // transfer broken, might even be a new client with the
                 // same window id
-                it->second.erase( aTimeouts.front() );
-                aTimeouts.pop_front();
+                it->second.erase( timeout );
             }
+            aTimeouts.clear();
 
             auto inc_it = it->second.find( rNotify.atom );
             if( inc_it != it->second.end() )
@@ -3658,7 +3658,7 @@ void SelectionManager::run( void* pThis )
         if( (aNow.tv_sec - aLast.tv_sec) > 0 )
         {
             osl::ClearableMutexGuard aGuard(This->m_aMutex);
-            std::list< std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > > aChangeList;
+            std::vector< std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > > > aChangeVector;
 
             for (auto const& selection : This->m_aSelections)
             {
@@ -3670,15 +3670,14 @@ void SelectionManager::run( void* pThis )
                         selection.second->m_aLastOwner = aOwner;
                         std::pair< SelectionAdaptor*, css::uno::Reference< XInterface > >
                             aKeep( selection.second->m_pAdaptor, selection.second->m_pAdaptor->getReference() );
-                        aChangeList.push_back( aKeep );
+                        aChangeVector.push_back( aKeep );
                     }
                 }
             }
             aGuard.clear();
-            while( !aChangeList.empty() )
+            for (auto const& change : aChangeVector)
             {
-                aChangeList.front().first->fireContentsChanged();
-                aChangeList.pop_front();
+                change.first->fireContentsChanged();
             }
             aLast = aNow;
         }


More information about the Libreoffice-commits mailing list