From 102f257ee007aecaccbf1370a3c89104d87fe43f Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Mon, 4 Dec 2017 21:57:42 +0100 Subject: Replace list by vector for MailDispatcherListenerContainer_t (sw) Change-Id: Iac66ae6cb9f95133ef705850c246309db41872dc Reviewed-on: https://gerrit.libreoffice.org/45826 Tested-by: Jenkins Reviewed-by: Julien Nabet --- sw/source/uibase/dbui/maildispatcher.cxx | 28 ++++++++++++++-------------- sw/source/uibase/inc/maildispatcher.hxx | 5 +++-- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'sw/source/uibase') diff --git a/sw/source/uibase/dbui/maildispatcher.cxx b/sw/source/uibase/dbui/maildispatcher.cxx index 89678bc34529..ae789beb30c5 100644 --- a/sw/source/uibase/dbui/maildispatcher.cxx +++ b/sw/source/uibase/dbui/maildispatcher.cxx @@ -27,7 +27,7 @@ using namespace ::com::sun::star; -typedef std::list< ::rtl::Reference > MailDispatcherListenerContainer_t; +typedef std::vector< ::rtl::Reference > MailDispatcherListenerContainer_t; namespace /* private */ { @@ -153,8 +153,8 @@ void MailDispatcher::start() m_aWakeupCondition.set(); thread_status_guard.clear(); - MailDispatcherListenerContainer_t aClonedListenerList(cloneListener()); - std::for_each( aClonedListenerList.begin(), aClonedListenerList.end(), + MailDispatcherListenerContainer_t aClonedListenerVector(cloneListener()); + std::for_each( aClonedListenerVector.begin(), aClonedListenerVector.end(), GenericEventNotifier(&IMailDispatcherListener::started, this) ); } } @@ -173,8 +173,8 @@ void MailDispatcher::stop() m_aWakeupCondition.reset(); thread_status_guard.clear(); - MailDispatcherListenerContainer_t aClonedListenerList(cloneListener()); - std::for_each( aClonedListenerList.begin(), aClonedListenerList.end(), + MailDispatcherListenerContainer_t aClonedListenerVector(cloneListener()); + std::for_each( aClonedListenerVector.begin(), aClonedListenerVector.end(), GenericEventNotifier(&IMailDispatcherListener::stopped, this) ); } } @@ -195,13 +195,13 @@ void MailDispatcher::addListener(::rtl::Reference const OSL_PRECOND(!m_bShutdownRequested, "MailDispatcher thread is shuting down already"); ::osl::MutexGuard guard( m_aListenerContainerMutex ); - m_aListenerList.push_back( listener ); + m_aListenerVector.push_back( listener ); } -std::list< ::rtl::Reference > MailDispatcher::cloneListener() +std::vector< ::rtl::Reference > MailDispatcher::cloneListener() { ::osl::MutexGuard guard( m_aListenerContainerMutex ); - return m_aListenerList; + return m_aListenerVector; } void MailDispatcher::sendMailMessageNotifyListener(uno::Reference const & message) @@ -209,20 +209,20 @@ void MailDispatcher::sendMailMessageNotifyListener(uno::ReferencesendMailMessage( message ); - MailDispatcherListenerContainer_t aClonedListenerList(cloneListener()); - std::for_each( aClonedListenerList.begin(), aClonedListenerList.end(), + MailDispatcherListenerContainer_t aClonedListenerVector(cloneListener()); + std::for_each( aClonedListenerVector.begin(), aClonedListenerVector.end(), MailDeliveryNotifier(this, message) ); } catch (const mail::MailException& ex) { - MailDispatcherListenerContainer_t aClonedListenerList(cloneListener()); - std::for_each( aClonedListenerList.begin(), aClonedListenerList.end(), + MailDispatcherListenerContainer_t aClonedListenerVector(cloneListener()); + std::for_each( aClonedListenerVector.begin(), aClonedListenerVector.end(), MailDeliveryErrorNotifier(this, message, ex.Message) ); } catch (const uno::RuntimeException& ex) { - MailDispatcherListenerContainer_t aClonedListenerList(cloneListener()); - std::for_each( aClonedListenerList.begin(), aClonedListenerList.end(), + MailDispatcherListenerContainer_t aClonedListenerVector(cloneListener()); + std::for_each( aClonedListenerVector.begin(), aClonedListenerVector.end(), MailDeliveryErrorNotifier(this, message, ex.Message) ); } } diff --git a/sw/source/uibase/inc/maildispatcher.hxx b/sw/source/uibase/inc/maildispatcher.hxx index ddcb48e30ce6..af7494b19d87 100644 --- a/sw/source/uibase/inc/maildispatcher.hxx +++ b/sw/source/uibase/inc/maildispatcher.hxx @@ -28,6 +28,7 @@ #include #include +#include #include @@ -136,13 +137,13 @@ protected: virtual void SAL_CALL onTerminated() override; private: - std::list< ::rtl::Reference > cloneListener(); + std::vector< ::rtl::Reference > cloneListener(); void sendMailMessageNotifyListener(css::uno::Reference< css::mail::XMailMessage> const & message); private: css::uno::Reference< css::mail::XSmtpService> m_xMailserver; std::list< css::uno::Reference< css::mail::XMailMessage > > m_aXMessageList; - std::list< ::rtl::Reference > m_aListenerList; + std::vector< ::rtl::Reference > m_aListenerVector; ::osl::Mutex m_aMessageContainerMutex; ::osl::Mutex m_aListenerContainerMutex; ::osl::Mutex m_aThreadStatusMutex; -- cgit