chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx | 10 chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx | 9 filter/source/xsltdialog/xmlfilterdialogcomponent.cxx | 102 +--------- 3 files changed, 26 insertions(+), 95 deletions(-)
New commits: commit 8b31341d9382b62d99a4c1f801d63d031a47ffc3 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 23 11:05:40 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Feb 24 07:12:40 2023 +0000 BaseMutex->std::mutex in MinMaxLineWrapper Change-Id: Ibd03c7f736e9b2fdf97a7b3177d7d12fd85394fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147581 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx index 3d61e81a371f..925c85834fa0 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx @@ -118,7 +118,6 @@ namespace chart::wrapper MinMaxLineWrapper::MinMaxLineWrapper(std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : m_spChart2ModelContact(std::move( spChart2ModelContact )) - , m_aEventListenerContainer( m_aMutex ) , m_aWrappedLineJointProperty( "LineJoint", uno::Any( drawing::LineJoint_NONE )) { } @@ -130,20 +129,23 @@ MinMaxLineWrapper::~MinMaxLineWrapper() // ____ XComponent ____ void SAL_CALL MinMaxLineWrapper::dispose() { + std::unique_lock g(m_aMutex); Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); - m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); + m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) ); } void SAL_CALL MinMaxLineWrapper::addEventListener( const Reference< lang::XEventListener >& xListener ) { - m_aEventListenerContainer.addInterface( xListener ); + std::unique_lock g(m_aMutex); + m_aEventListenerContainer.addInterface( g, xListener ); } void SAL_CALL MinMaxLineWrapper::removeEventListener( const Reference< lang::XEventListener >& aListener ) { - m_aEventListenerContainer.removeInterface( aListener ); + std::unique_lock g(m_aMutex); + m_aEventListenerContainer.removeInterface( g, aListener ); } //XPropertySet diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx index 3c5c9afdcb4c..337ca8bdebd7 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx @@ -19,9 +19,8 @@ #pragma once #include <WrappedIgnoreProperty.hxx> -#include <comphelper/interfacecontainer3.hxx> +#include <comphelper/interfacecontainer4.hxx> -#include <cppuhelper/basemutex.hxx> #include <cppuhelper/implbase.hxx> #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/beans/XMultiPropertyStates.hpp> @@ -37,8 +36,7 @@ namespace chart::wrapper class Chart2ModelContact; -class MinMaxLineWrapper : public cppu::BaseMutex - , public ::cppu::WeakImplHelper +class MinMaxLineWrapper : public ::cppu::WeakImplHelper < css::lang::XComponent , css::lang::XServiceInfo , css::beans::XPropertySet @@ -93,8 +91,9 @@ public: virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override; private: //member + std::mutex m_aMutex; std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer; WrappedIgnoreProperty m_aWrappedLineJointProperty; }; commit ce32856bfe51ee844f6374ba2161eae821f9df61 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 23 10:33:51 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Feb 24 07:12:29 2023 +0000 drop OComponentHelper in XMLFilterDialogComponent nothing seems to be using the aggregation here - as expected, this is not the kind of thing that is aggregated Change-Id: I8abc4f4db0dc9447e4018330bba86f3579bb21c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147503 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 6f4b1db3453b..5cf047d07e41 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -17,11 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <osl/mutex.hxx> - #include <comphelper/servicehelper.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/component.hxx> +#include <comphelper/compbase.hxx> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> #include <cppuhelper/supportsservice.hxx> @@ -44,33 +42,19 @@ using namespace ::com::sun::star::frame; namespace { -class XMLFilterDialogComponentBase -{ -protected: - ::osl::Mutex maMutex; -}; - -class XMLFilterDialogComponent : public XMLFilterDialogComponentBase, - public OComponentHelper, - public css::ui::dialogs::XExecutableDialog, - public XServiceInfo, - public XInitialization, - public XTerminateListener +class XMLFilterDialogComponent : public comphelper::WeakComponentImplHelper< + css::ui::dialogs::XExecutableDialog, + XServiceInfo, + XInitialization, + XTerminateListener> { public: explicit XMLFilterDialogComponent( const Reference< XComponentContext >& rxContext ); - // XInterface - virtual Any SAL_CALL queryInterface( const Type& aType ) override; - virtual Any SAL_CALL queryAggregation( Type const & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - protected: // XTypeProvider virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - virtual Sequence< Type > SAL_CALL getTypes() override; // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; @@ -91,7 +75,7 @@ protected: /** Called in dispose method after the listeners were notified. */ - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>& rGuard) override; private: css::uno::Reference<css::awt::XWindow> mxParent; /// parent window @@ -103,59 +87,13 @@ private: } XMLFilterDialogComponent::XMLFilterDialogComponent(const css::uno::Reference< XComponentContext >& rxContext) - : OComponentHelper(maMutex) - , mxContext(rxContext) + : mxContext(rxContext) { Reference< XDesktop2 > xDesktop = Desktop::create( rxContext ); Reference< XTerminateListener > xListener( this ); xDesktop->addTerminateListener( xListener ); } -// XInterface -Any SAL_CALL XMLFilterDialogComponent::queryInterface( const Type& aType ) -{ - return OComponentHelper::queryInterface( aType ); -} - - -Any SAL_CALL XMLFilterDialogComponent::queryAggregation( Type const & rType ) -{ - if (rType == cppu::UnoType<css::ui::dialogs::XExecutableDialog>::get()) - { - void * p = static_cast< css::ui::dialogs::XExecutableDialog * >( this ); - return Any( &p, rType ); - } - else if (rType == cppu::UnoType<XServiceInfo>::get()) - { - void * p = static_cast< XServiceInfo * >( this ); - return Any( &p, rType ); - } - else if (rType == cppu::UnoType<XInitialization>::get()) - { - void * p = static_cast< XInitialization * >( this ); - return Any( &p, rType ); - } - else if (rType == cppu::UnoType<XTerminateListener>::get()) - { - void * p = static_cast< XTerminateListener * >( this ); - return Any( &p, rType ); - } - return OComponentHelper::queryAggregation( rType ); -} - - -void SAL_CALL XMLFilterDialogComponent::acquire() noexcept -{ - OComponentHelper::acquire(); -} - - -void SAL_CALL XMLFilterDialogComponent::release() noexcept -{ - OComponentHelper::release(); -} - - OUString SAL_CALL XMLFilterDialogComponent::getImplementationName() { return "com.sun.star.comp.ui.XSLTFilterDialog"; @@ -168,18 +106,6 @@ Sequence< sal_Int8 > SAL_CALL XMLFilterDialogComponent::getImplementationId() } -Sequence< Type > XMLFilterDialogComponent::getTypes() -{ - return { cppu::UnoType<XComponent>::get(), - cppu::UnoType<XTypeProvider>::get(), - cppu::UnoType<XAggregation>::get(), - cppu::UnoType<XWeak>::get(), - cppu::UnoType<XServiceInfo>::get(), - cppu::UnoType<XInitialization>::get(), - cppu::UnoType<XTerminateListener>::get(), - cppu::UnoType<css::ui::dialogs::XExecutableDialog>::get() }; -} - Sequence< OUString > SAL_CALL XMLFilterDialogComponent::getSupportedServiceNames() { return { "com.sun.star.ui.dialogs.XSLTFilterDialog" }; @@ -192,12 +118,16 @@ sal_Bool SAL_CALL XMLFilterDialogComponent::supportsService(const OUString& Serv /** Called in dispose method after the listeners were notified. */ -void SAL_CALL XMLFilterDialogComponent::disposing() +void XMLFilterDialogComponent::disposing(std::unique_lock<std::mutex>& rGuard) { - ::SolarMutexGuard aGuard; + rGuard.unlock(); + { + ::SolarMutexGuard aGuard; - if (mxDialog) - mxDialog->response(RET_CLOSE); + if (mxDialog) + mxDialog->response(RET_CLOSE); + } + rGuard.lock(); }