avmedia/source/framework/soundhandler.cxx | 4 +- avmedia/source/framework/soundhandler.hxx | 4 +- basic/source/classes/sbunoobj.cxx | 13 ++++----- include/toolkit/helper/listenermultiplexer.hxx | 6 ++-- include/toolkit/helper/mutexhelper.hxx | 36 ------------------------- 5 files changed, 14 insertions(+), 49 deletions(-)
New commits: commit 4c72b9d08afbb3c503c33b37771f1dc8968df1bb Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sat Dec 18 09:39:24 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Dec 18 19:49:53 2021 +0100 use more cppu::BaseMutex Change-Id: I9defebeb9cb0ba22df3578c8aae7501add36a11c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127078 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index 07bee2113358..7d26c252201b 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -164,7 +164,7 @@ void SAL_CALL SoundHandler::dispatchWithNotification(const css::util::URL& const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) { // SAFE { - const ::osl::MutexGuard aLock( GetMutex() ); + const ::osl::MutexGuard aLock( m_aMutex ); utl::MediaDescriptor aDescriptor(lDescriptor); @@ -276,7 +276,7 @@ OUString SAL_CALL SoundHandler::detect( css::uno::Sequence< css::beans::Property IMPL_LINK_NOARG(SoundHandler, implts_PlayerNotify, Timer *, void) { // SAFE { - ::osl::ClearableMutexGuard aLock( GetMutex() ); + ::osl::ClearableMutexGuard aLock( m_aMutex ); if (m_xPlayer.is() && m_xPlayer->isPlaying() && m_xPlayer->getMediaTime() < m_xPlayer->getDuration()) { diff --git a/avmedia/source/framework/soundhandler.hxx b/avmedia/source/framework/soundhandler.hxx index 5575bba1876c..648cbe59dd4b 100644 --- a/avmedia/source/framework/soundhandler.hxx +++ b/avmedia/source/framework/soundhandler.hxx @@ -29,12 +29,12 @@ #include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/weak.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> #include <tools/link.hxx> -#include <toolkit/helper/mutexhelper.hxx> namespace avmedia{ @@ -56,7 +56,7 @@ class SoundHandler : // interfaces , public css::document::XExtendedFilterDetection // baseclasses // Order is necessary for right initialization! - , private MutexHelper + , private cppu::BaseMutex , public ::cppu::OWeakObject { // public methods diff --git a/include/toolkit/helper/listenermultiplexer.hxx b/include/toolkit/helper/listenermultiplexer.hxx index 45267944c40e..b562e9e2852c 100644 --- a/include/toolkit/helper/listenermultiplexer.hxx +++ b/include/toolkit/helper/listenermultiplexer.hxx @@ -42,10 +42,10 @@ #include <com/sun/star/awt/tree/XTreeExpansionListener.hpp> #include <com/sun/star/awt/tree/XTreeEditListener.hpp> #include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/weak.hxx> #include <comphelper/interfacecontainer3.hxx> -#include <toolkit/helper/mutexhelper.hxx> #include <toolkit/helper/macros.hxx> #include <com/sun/star/awt/grid/XGridSelectionListener.hpp> #include <com/sun/star/awt/tab/XTabPageContainerListener.hpp> @@ -53,7 +53,7 @@ // class ListenerMultiplexerBase template <class ListenerT> -class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) ListenerMultiplexerBase : public MutexHelper, +class UNLESS_MERGELIBS(TOOLKIT_DLLPUBLIC) ListenerMultiplexerBase : public cppu::BaseMutex, public ::comphelper::OInterfaceContainerHelper3<ListenerT>, public css::uno::XInterface { @@ -65,7 +65,7 @@ protected: public: ListenerMultiplexerBase( ::cppu::OWeakObject& rSource ) - : ::comphelper::OInterfaceContainerHelper3<ListenerT>(GetMutex()), mrContext(rSource) + : ::comphelper::OInterfaceContainerHelper3<ListenerT>(m_aMutex), mrContext(rSource) { } diff --git a/include/toolkit/helper/mutexhelper.hxx b/include/toolkit/helper/mutexhelper.hxx deleted file mode 100644 index 80c6c7303e67..000000000000 --- a/include/toolkit/helper/mutexhelper.hxx +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_TOOLKIT_HELPER_MUTEXHELPER_HXX -#define INCLUDED_TOOLKIT_HELPER_MUTEXHELPER_HXX - -#include <osl/mutex.hxx> - -class MutexHelper -{ -private: - ::osl::Mutex maMutex; - -public: - ::osl::Mutex& GetMutex() { return maMutex; } -}; - -#endif // INCLUDED_TOOLKIT_HELPER_MUTEXHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit fcba66fa86a77a3ca86705a4f145f8aae198ff87 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Dec 17 18:57:03 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Dec 18 19:49:38 2021 +0100 osl::Mutex->std::mutex in ModuleInvocationProxy Change-Id: I2ec935fb1c53338f475d5e8aec877f84824a56e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127074 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 9e1d31fb4ac1..362ea2d42898 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -27,7 +27,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/exc_hlp.hxx> -#include <comphelper/interfacecontainer2.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <comphelper/extract.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/weakref.hxx> @@ -4166,12 +4166,12 @@ namespace { class ModuleInvocationProxy : public WeakImplHelper< XInvocation, XComponent > { - ::osl::Mutex m_aMutex; + std::mutex m_aMutex; OUString m_aPrefix; SbxObjectRef m_xScopeObj; bool m_bProxyIsClassModuleObject; - ::comphelper::OInterfaceContainerHelper2 m_aListeners; + ::comphelper::OInterfaceContainerHelper4<XEventListener> m_aListeners; public: ModuleInvocationProxy( std::u16string_view aPrefix, SbxObjectRef const & xScopeObj ); @@ -4199,7 +4199,6 @@ public: ModuleInvocationProxy::ModuleInvocationProxy( std::u16string_view aPrefix, SbxObjectRef const & xScopeObj ) : m_aPrefix( OUString::Concat(aPrefix) + "_" ) , m_xScopeObj( xScopeObj ) - , m_aListeners( m_aMutex ) { m_bProxyIsClassModuleObject = xScopeObj.is() && dynamic_cast<const SbClassModuleObject*>( xScopeObj.get() ) != nullptr; } @@ -4355,21 +4354,23 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const OUString& rFunction, void SAL_CALL ModuleInvocationProxy::dispose() { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); EventObject aEvent( static_cast<XComponent*>(this) ); - m_aListeners.disposeAndClear( aEvent ); + m_aListeners.disposeAndClear( aGuard, aEvent ); m_xScopeObj = nullptr; } void SAL_CALL ModuleInvocationProxy::addEventListener( const Reference< XEventListener >& xListener ) { + std::unique_lock aGuard( m_aMutex ); m_aListeners.addInterface( xListener ); } void SAL_CALL ModuleInvocationProxy::removeEventListener( const Reference< XEventListener >& xListener ) { + std::unique_lock aGuard( m_aMutex ); m_aListeners.removeInterface( xListener ); }