chart2/inc/ChartView.hxx | 8 ++++---- chart2/source/view/main/ChartView.cxx | 20 +++++++------------- 2 files changed, 11 insertions(+), 17 deletions(-)
New commits: commit b96a0a214ba98701ff56a0b531d652c6905d6c1e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Feb 15 16:11:53 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Feb 16 09:00:28 2023 +0000 osl::Mutex->std::mutex in ChartView Change-Id: I74974a8e11885e0bb4773b56858a69816fd1ac41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147103 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index b521f2e8715b..ea41dc7d667d 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -20,7 +20,7 @@ #include <chartview/ExplicitValueProvider.hxx> #include <cppuhelper/implbase.hxx> -#include <comphelper/multicontainer2.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <svl/lstner.hxx> #include <com/sun/star/awt/Size.hpp> @@ -201,7 +201,7 @@ private: //methods DECL_LINK( UpdateTimeBased, Timer*, void ); private: //member - ::osl::Mutex m_aMutex; + std::mutex m_aMutex; css::uno::Reference< css::uno::XComponentContext> m_xCC; @@ -225,8 +225,8 @@ private: //member std::vector< std::unique_ptr<VCoordinateSystem> > m_aVCooSysList; - comphelper::OMultiTypeInterfaceContainerHelper2 - m_aListenerContainer; + comphelper::OInterfaceContainerHelper4<css::util::XModeChangeListener> + m_aModeChangeListeners; bool m_bViewDirty; //states whether the view needs to be rebuild bool m_bInViewUpdate; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 2f87382bde56..c7e3d6d092a2 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -165,7 +165,6 @@ ChartView::ChartView( ChartModel& rModel) : m_xCC(std::move(xContext)) , mrChartModel(rModel) - , m_aListenerContainer( m_aMutex ) , m_bViewDirty(true) , m_bInViewUpdate(false) , m_bViewUpdatePending(false) @@ -1559,16 +1558,11 @@ void ChartView::impl_notifyModeChangeListener( const OUString& rNewMode ) { try { - comphelper::OInterfaceContainerHelper2* pIC = m_aListenerContainer - .getContainer( cppu::UnoType<util::XModeChangeListener>::get()); - if( pIC ) + std::unique_lock g(m_aMutex); + if( m_aModeChangeListeners.getLength(g) ) { util::ModeChangeEvent aEvent( static_cast< uno::XWeak* >( this ), rNewMode ); - comphelper::OInterfaceIteratorHelper2 aIt( *pIC ); - while( aIt.hasMoreElements() ) - { - static_cast< util::XModeChangeListener* >( aIt.next() )->modeChanged( aEvent ); - } + m_aModeChangeListeners.notifyEach( g, &css::util::XModeChangeListener::modeChanged, aEvent); } } catch( const uno::Exception& ) @@ -1581,13 +1575,13 @@ void ChartView::impl_notifyModeChangeListener( const OUString& rNewMode ) void SAL_CALL ChartView::addModeChangeListener( const uno::Reference< util::XModeChangeListener >& xListener ) { - m_aListenerContainer.addInterface( - cppu::UnoType<util::XModeChangeListener>::get(), xListener ); + std::unique_lock g(m_aMutex); + m_aModeChangeListeners.addInterface(g, xListener ); } void SAL_CALL ChartView::removeModeChangeListener( const uno::Reference< util::XModeChangeListener >& xListener ) { - m_aListenerContainer.removeInterface( - cppu::UnoType<util::XModeChangeListener>::get(), xListener ); + std::unique_lock g(m_aMutex); + m_aModeChangeListeners.removeInterface(g, xListener ); } void SAL_CALL ChartView::addModeChangeApproveListener( const uno::Reference< util::XModeChangeApproveListener >& /* _rxListener */ ) {