[Libreoffice-commits] core.git: vcl/inc vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Apr 9 06:37:47 UTC 2018


 vcl/inc/displayconnectiondispatch.hxx           |    6 ++----
 vcl/source/helper/displayconnectiondispatch.cxx |   16 +++++-----------
 2 files changed, 7 insertions(+), 15 deletions(-)

New commits:
commit 54f7d107c121403d0a73454ef83f79e0e61b757b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Sat Apr 7 13:46:03 2018 +0200

    std::list->std::vector in DisplayConnectionDispatch
    
    and remove effectively unused m_aErrorHandlers
    
    Change-Id: I7505d1d27ccbde2728c01c41ff91faa846429d7d
    Reviewed-on: https://gerrit.libreoffice.org/52540
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/inc/displayconnectiondispatch.hxx b/vcl/inc/displayconnectiondispatch.hxx
index 73beb2ab4829..ff12478b7bea 100644
--- a/vcl/inc/displayconnectiondispatch.hxx
+++ b/vcl/inc/displayconnectiondispatch.hxx
@@ -26,7 +26,7 @@
 #include <osl/mutex.hxx>
 #include <rtl/ref.hxx>
 #include <com/sun/star/uno/Reference.hxx>
-#include <list>
+#include <vector>
 
 namespace vcl {
 
@@ -34,10 +34,8 @@ class DisplayConnectionDispatch :
     public cppu::WeakImplHelper< css::awt::XDisplayConnection >
 {
     ::osl::Mutex                    m_aMutex;
-    ::std::list< css::uno::Reference< css::awt::XEventHandler > >
+    ::std::vector< css::uno::Reference< css::awt::XEventHandler > >
                                     m_aHandlers;
-    ::std::list< css::uno::Reference< css::awt::XEventHandler > >
-                                    m_aErrorHandlers;
     OUString                        m_ConnectionIdentifier;
 public:
     DisplayConnectionDispatch();
diff --git a/vcl/source/helper/displayconnectiondispatch.cxx b/vcl/source/helper/displayconnectiondispatch.cxx
index 5d1e9a966459..1128b5ee6973 100644
--- a/vcl/source/helper/displayconnectiondispatch.cxx
+++ b/vcl/source/helper/displayconnectiondispatch.cxx
@@ -57,7 +57,7 @@ void DisplayConnectionDispatch::terminate()
 
     MutexGuard aGuard( m_aMutex );
     Any aEvent;
-    std::list< css::uno::Reference< XEventHandler > > aLocalList( m_aHandlers );
+    std::vector< css::uno::Reference< XEventHandler > > aLocalList( m_aHandlers );
     for (auto const& elem : aLocalList)
         elem->handleEvent( aEvent );
 }
@@ -73,21 +73,15 @@ void SAL_CALL DisplayConnectionDispatch::removeEventHandler( const Any& /*window
 {
     MutexGuard aGuard( m_aMutex );
 
-    m_aHandlers.remove( handler );
+    m_aHandlers.erase( std::remove(m_aHandlers.begin(), m_aHandlers.end(), handler), m_aHandlers.end() );
 }
 
-void SAL_CALL DisplayConnectionDispatch::addErrorHandler( const css::uno::Reference< XEventHandler >& handler )
+void SAL_CALL DisplayConnectionDispatch::addErrorHandler( const css::uno::Reference< XEventHandler >& )
 {
-    MutexGuard aGuard( m_aMutex );
-
-    m_aErrorHandlers.push_back( handler );
 }
 
-void SAL_CALL DisplayConnectionDispatch::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler )
+void SAL_CALL DisplayConnectionDispatch::removeErrorHandler( const css::uno::Reference< XEventHandler >& )
 {
-    MutexGuard aGuard( m_aMutex );
-
-    m_aErrorHandlers.remove( handler );
 }
 
 Any SAL_CALL DisplayConnectionDispatch::getIdentifier()
@@ -102,7 +96,7 @@ bool DisplayConnectionDispatch::dispatchEvent( void const * pData, int nBytes )
     Sequence< sal_Int8 > aSeq( static_cast<const sal_Int8*>(pData), nBytes );
     Any aEvent;
     aEvent <<= aSeq;
-    ::std::list< css::uno::Reference< XEventHandler > > handlers;
+    ::std::vector< css::uno::Reference< XEventHandler > > handlers;
     {
         MutexGuard aGuard( m_aMutex );
         handlers = m_aHandlers;


More information about the Libreoffice-commits mailing list