diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-07 13:46:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-09 08:37:24 +0200 |
commit | 54f7d107c121403d0a73454ef83f79e0e61b757b (patch) | |
tree | b4d11602d3a67125c3ca368977debb623ecd9071 /vcl | |
parent | 6b88669498eafbe75eb3667f5997886e8b99ded7 (diff) |
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@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/displayconnectiondispatch.hxx | 6 | ||||
-rw-r--r-- | vcl/source/helper/displayconnectiondispatch.cxx | 16 |
2 files changed, 7 insertions, 15 deletions
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; |