diff options
45 files changed, 138 insertions, 195 deletions
diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx index cba7eed36c38..a45f0ed6856f 100644 --- a/UnoControls/inc/basecontrol.hxx +++ b/UnoControls/inc/basecontrol.hxx @@ -27,6 +27,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <osl/mutex.hxx> #include <cppuhelper/component.hxx> +#include <cppuhelper/basemutex.hxx> #include <rtl/ref.hxx> namespace com::sun::star::uno { class XComponentContext; } @@ -39,19 +40,13 @@ namespace unocontrols { class OMRCListenerMultiplexerHelper; } namespace unocontrols { -struct IMPL_MutexContainer -{ - // Is necessary to initialize "BaseControl" and make this class thread-safe. - ::osl::Mutex m_aMutex; -}; - class BaseControl : public css::lang::XServiceInfo , public css::awt::XPaintListener , public css::awt::XWindowListener , public css::awt::XView , public css::awt::XWindow , public css::awt::XControl - , public IMPL_MutexContainer + , public cppu::BaseMutex , public ::cppu::OComponentHelper { public: diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx index f76b605202ab..da80678307b7 100644 --- a/UnoControls/source/base/basecontrol.cxx +++ b/UnoControls/source/base/basecontrol.cxx @@ -49,8 +49,7 @@ namespace unocontrols { // construct/destruct BaseControl::BaseControl( const Reference< XComponentContext >& rxContext ) - : IMPL_MutexContainer ( ) - , OComponentHelper ( m_aMutex ) + : OComponentHelper ( m_aMutex ) , m_xComponentContext ( rxContext ) , m_nX ( DEFAULT_X ) , m_nY ( DEFAULT_Y ) diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx index f39f8a380e91..8e86cb2d5c0f 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx @@ -21,6 +21,7 @@ #include <osl/mutex.hxx> #include <cppuhelper/implbase.hxx> +#include <cppuhelper/basemutex.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/util/XOfficeInstallationDirectories.hpp> @@ -37,12 +38,7 @@ typedef cppu::WeakImplHelper< css::util::XOfficeInstallationDirectories, css::lang::XServiceInfo > UnoImplBase; -struct mutex_holder -{ - osl::Mutex m_aMutex; -}; - -class OfficeInstallationDirectories : public mutex_holder, public UnoImplBase +class OfficeInstallationDirectories : public cppu::BaseMutex, public UnoImplBase { public: explicit OfficeInstallationDirectories( diff --git a/connectivity/source/drivers/postgresql/pq_driver.hxx b/connectivity/source/drivers/postgresql/pq_driver.hxx index 6be6a39484f3..c35a117f7816 100644 --- a/connectivity/source/drivers/postgresql/pq_driver.hxx +++ b/connectivity/source/drivers/postgresql/pq_driver.hxx @@ -39,6 +39,7 @@ #include <osl/mutex.hxx> #include <sal/macros.h> #include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -54,7 +55,6 @@ namespace pq_sdbc_driver SAL_STRINGIFY(PQ_SDBC_MINOR) "." \ SAL_STRINGIFY(PQ_SDBC_MICRO) -struct MutexHolder { osl::Mutex m_mutex; }; // use this to switch off sdbc support ! // typedef cppu::WeakComponentImplHelper< // css::sdbc::XDriver, @@ -64,14 +64,14 @@ typedef cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo, css::sdbcx::XDataDefinitionSupplier > DriverBase ; -class Driver : public MutexHolder, public DriverBase +class Driver : public cppu::BaseMutex, public DriverBase { css::uno::Reference< css::uno::XComponentContext > m_ctx; css::uno::Reference< css::lang::XMultiComponentFactory > m_smgr; public: explicit Driver ( const css::uno::Reference < css::uno::XComponentContext > & ctx ) - : DriverBase( m_mutex ), + : DriverBase( m_aMutex ), m_ctx( ctx ), m_smgr( ctx->getServiceManager() ) {} diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index a4c56bba251d..dd8f5e8d0686 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -45,7 +45,7 @@ namespace accessibility { AccessibleContextBase::AccessibleContextBase ( const uno::Reference<XAccessible>& rxParent, const sal_Int16 aRole) - : WeakComponentImplHelper(MutexOwner::maMutex), + : WeakComponentImplHelper(m_aMutex), mxParent(rxParent), meDescriptionOrigin(NotSet), meNameOrigin(NotSet), @@ -75,7 +75,7 @@ AccessibleContextBase::~AccessibleContextBase() bool AccessibleContextBase::SetState (sal_Int16 aState) { - ::osl::ClearableMutexGuard aGuard (maMutex); + ::osl::ClearableMutexGuard aGuard (m_aMutex); ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); if ((pStateSet != nullptr) && !pStateSet->contains(aState)) @@ -104,7 +104,7 @@ bool AccessibleContextBase::SetState (sal_Int16 aState) bool AccessibleContextBase::ResetState (sal_Int16 aState) { - ::osl::ClearableMutexGuard aGuard (maMutex); + ::osl::ClearableMutexGuard aGuard (m_aMutex); ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); if ((pStateSet != nullptr) && pStateSet->contains(aState)) @@ -128,7 +128,7 @@ bool AccessibleContextBase::ResetState (sal_Int16 aState) bool AccessibleContextBase::GetState (sal_Int16 aState) { - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); if (pStateSet != nullptr) @@ -415,7 +415,7 @@ void SAL_CALL AccessibleContextBase::disposing() { SetState (AccessibleStateType::DEFUNC); - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); // Send a disposing to all listeners. if ( mnClientId ) diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx index 9ed6a115e2b7..41fbe634cc34 100644 --- a/extensions/source/config/ldap/ldapuserprofilebe.cxx +++ b/extensions/source/config/ldap/ldapuserprofilebe.cxx @@ -35,8 +35,7 @@ namespace extensions::config::ldap { LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContext>& xContext) -: LdapProfileMutexHolder(), - BackendBase(mMutex) +: BackendBase(m_aMutex) { LdapDefinition aDefinition; OUString loggedOnUser; diff --git a/extensions/source/config/ldap/ldapuserprofilebe.hxx b/extensions/source/config/ldap/ldapuserprofilebe.hxx index 06e8c8f5a0dd..2f05365328db 100644 --- a/extensions/source/config/ldap/ldapuserprofilebe.hxx +++ b/extensions/source/config/ldap/ldapuserprofilebe.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> #include "ldapaccess.hxx" @@ -41,13 +42,12 @@ struct LdapDefinition; typedef cppu::WeakComponentImplHelper<css::beans::XPropertySet, lang::XServiceInfo> BackendBase ; -struct LdapProfileMutexHolder { osl::Mutex mMutex; }; /** Implements the PlatformBackend service, a specialization of the XPropertySet service for retrieving LDAP user profile configuration settings from an LDAP repository. */ -class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase +class LdapUserProfileBe : private cppu::BaseMutex, public BackendBase { public: diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index 10dd76d82d3e..97e7b7f22bea 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -33,9 +33,8 @@ namespace filter::config{ BaseContainer::BaseContainer() - : BaseLock ( ) - , m_eType() - , m_lListener (m_aLock) + : m_eType() + , m_lListener (m_aMutex) { GetTheFilterCache().load(FilterCache::E_CONTAINS_STANDARD); } @@ -52,7 +51,7 @@ void BaseContainer::init(const css::uno::Reference< css::uno::XComponentContext FilterCache::EItemType eType ) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); m_sImplementationName = sImplementationName; m_lServiceNames = lServiceNames ; @@ -66,7 +65,7 @@ void BaseContainer::impl_loadOnDemand() { #ifdef LOAD_IMPLICIT // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // A generic container needs all items of a set of our cache! // Of course it can block for a while, till the cache is really filled. @@ -101,7 +100,7 @@ void BaseContainer::impl_loadOnDemand() void BaseContainer::impl_initFlushMode() { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); if (!m_pFlushCache) m_pFlushCache = GetTheFilterCache().clone(); if (!m_pFlushCache) @@ -114,7 +113,7 @@ void BaseContainer::impl_initFlushMode() FilterCache* BaseContainer::impl_getWorkingCache() const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); if (m_pFlushCache) return m_pFlushCache.get(); else @@ -161,7 +160,7 @@ void SAL_CALL BaseContainer::insertByName(const OUString& sItem , impl_loadOnDemand(); // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // create write copy of used cache on demand ... impl_initFlushMode(); @@ -179,7 +178,7 @@ void SAL_CALL BaseContainer::removeByName(const OUString& sItem) impl_loadOnDemand(); // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // create write copy of used cache on demand ... impl_initFlushMode(); @@ -211,7 +210,7 @@ void SAL_CALL BaseContainer::replaceByName(const OUString& sItem , impl_loadOnDemand(); // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // create write copy of used cache on demand ... impl_initFlushMode(); @@ -235,7 +234,7 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const OUString& sItem) impl_loadOnDemand(); // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); CacheItem aItem; try @@ -268,7 +267,7 @@ css::uno::Sequence< OUString > SAL_CALL BaseContainer::getElementNames() impl_loadOnDemand(); // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); try { @@ -295,7 +294,7 @@ sal_Bool SAL_CALL BaseContainer::hasByName(const OUString& sItem) impl_loadOnDemand(); // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); try { @@ -329,7 +328,7 @@ sal_Bool SAL_CALL BaseContainer::hasElements() impl_loadOnDemand(); // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); try { @@ -363,7 +362,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea impl_loadOnDemand(); // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); try { @@ -403,7 +402,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea void SAL_CALL BaseContainer::flush() { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); if (!m_pFlushCache) throw css::lang::WrappedTargetRuntimeException( diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx index dee054d90731..4ed14d4f603a 100644 --- a/filter/source/config/cache/basecontainer.hxx +++ b/filter/source/config/cache/basecontainer.hxx @@ -49,7 +49,7 @@ namespace filter::config { present by this base class!) was full initialized inside our own ctor as first! */ -class BaseContainer : public BaseLock +class BaseContainer : public cppu::BaseMutex , public ::cppu::WeakImplHelper< css::lang::XServiceInfo , css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess css::container::XContainerQuery , diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx index f0c3558da856..4caf8eea324a 100644 --- a/filter/source/config/cache/cacheitem.hxx +++ b/filter/source/config/cache/cacheitem.hxx @@ -30,19 +30,6 @@ namespace filter::config { -/** @short Must be used as first derived base class - to get a full initialized mutex member, - which can be used during the ctor runs too! - */ -struct BaseLock -{ - public: - - // must be mutable to be usable in const environments too! - mutable ::osl::Mutex m_aLock; -}; - - /** @short represent an item of a FilterCache instance. diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx index 9616d7373df1..14331a190c2d 100644 --- a/filter/source/config/cache/cacheupdatelistener.cxx +++ b/filter/source/config/cache/cacheupdatelistener.cxx @@ -33,8 +33,7 @@ namespace filter::config{ CacheUpdateListener::CacheUpdateListener(FilterCache &rFilterCache, const css::uno::Reference< css::uno::XInterface >& xConfigAccess, FilterCache::EItemType eConfigType) - : BaseLock() - , m_rCache(rFilterCache) + : m_rCache(rFilterCache) , m_xConfig(xConfigAccess) , m_eConfigType(eConfigType) { @@ -47,7 +46,7 @@ CacheUpdateListener::~CacheUpdateListener() void CacheUpdateListener::startListening() { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY); aLock.clear(); // <- SAFE @@ -63,7 +62,7 @@ void CacheUpdateListener::startListening() void CacheUpdateListener::stopListening() { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY); aLock.clear(); // <- SAFE @@ -79,7 +78,7 @@ void CacheUpdateListener::stopListening() void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEvent& aEvent) { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); // disposed ? if ( ! m_xConfig.is()) @@ -173,7 +172,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven void SAL_CALL CacheUpdateListener::disposing(const css::lang::EventObject& aEvent) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); if (aEvent.Source == m_xConfig) m_xConfig.clear(); // <- SAFE diff --git a/filter/source/config/cache/cacheupdatelistener.hxx b/filter/source/config/cache/cacheupdatelistener.hxx index 9567b3bd3042..ff7e02759363 100644 --- a/filter/source/config/cache/cacheupdatelistener.hxx +++ b/filter/source/config/cache/cacheupdatelistener.hxx @@ -30,7 +30,7 @@ namespace filter::config { global filter cache, if the underlying configuration wa changed by other processes. */ -class CacheUpdateListener : public BaseLock // must be the first one to guarantee right initialized mutex member! +class CacheUpdateListener : public cppu::BaseMutex // must be the first one to guarantee right initialized mutex member! , public ::cppu::WeakImplHelper< css::util::XChangesListener > { diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx index 017fd8b19bb1..34ac28782b79 100644 --- a/filter/source/config/cache/configflush.cxx +++ b/filter/source/config/cache/configflush.cxx @@ -26,8 +26,7 @@ namespace filter::config{ ConfigFlush::ConfigFlush() - : BaseLock ( ) - , m_lListener(m_aLock) + : m_lListener(m_aMutex) { } diff --git a/filter/source/config/cache/configflush.hxx b/filter/source/config/cache/configflush.hxx index 20b1c14caae6..d5a9e53966c3 100644 --- a/filter/source/config/cache/configflush.hxx +++ b/filter/source/config/cache/configflush.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <comphelper/multicontainer2.hxx> #include <cppuhelper/implbase.hxx> +#include <cppuhelper/basemutex.hxx> namespace filter::config { @@ -34,7 +35,7 @@ namespace filter::config { @descr Such refresh listener will be called in case the type/filter configuration will be changed at runtime. */ -class ConfigFlush final : public BaseLock +class ConfigFlush final : public cppu::BaseMutex , public ::cppu::WeakImplHelper< css::util::XRefreshable, css::lang::XServiceInfo diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx index a3bf71cf22ed..864911798dfd 100644 --- a/filter/source/config/cache/contenthandlerfactory.cxx +++ b/filter/source/config/cache/contenthandlerfactory.cxx @@ -53,7 +53,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea css::uno::Reference< css::uno::XInterface > xHandler; // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); auto & cache = GetTheFilterCache(); diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 6ac9791129ba..4cfda1dc8b10 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -56,8 +56,7 @@ namespace filter::config{ FilterCache::FilterCache() - : BaseLock ( ) - , m_eFillState(E_CONTAINS_NOTHING ) + : m_eFillState(E_CONTAINS_NOTHING ) { int i = 0; OUString sStandardProps[10]; @@ -119,7 +118,7 @@ FilterCache::~FilterCache() std::unique_ptr<FilterCache> FilterCache::clone() const { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); auto pClone = std::make_unique<FilterCache>(); @@ -151,7 +150,7 @@ std::unique_ptr<FilterCache> FilterCache::clone() const void FilterCache::takeOver(const FilterCache& rClone) { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // a) // Don't copy the configuration access points here! @@ -199,7 +198,7 @@ void FilterCache::takeOver(const FilterCache& rClone) void FilterCache::load(EFillState eRequired) { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // check if required fill state is already reached ... // There is nothing to do then. @@ -238,7 +237,7 @@ void FilterCache::load(EFillState eRequired) bool FilterCache::isFillState(FilterCache::EFillState eState) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); return ((m_eFillState & eState) == eState); // <- SAFE } @@ -249,7 +248,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp const CacheItem& lEProps) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -279,7 +278,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp bool FilterCache::hasItems(EItemType eType) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -294,7 +293,7 @@ bool FilterCache::hasItems(EItemType eType) const std::vector<OUString> FilterCache::getItemNames(EItemType eType) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -315,7 +314,7 @@ bool FilterCache::hasItem( EItemType eType, const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -347,7 +346,7 @@ CacheItem FilterCache::getItem( EItemType eType, const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown if "eType" is unknown. @@ -397,7 +396,7 @@ void FilterCache::removeItem( EItemType eType, const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -418,7 +417,7 @@ void FilterCache::setItem( EItemType eType , const CacheItem& aValue) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -445,7 +444,7 @@ void FilterCache::refreshItem( EItemType eType, const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); impl_loadItemOnDemand(eType, sItem); } @@ -455,7 +454,7 @@ void FilterCache::addStatePropsToItem( EItemType eType, CacheItem& rItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // Note: Opening of the configuration layer throws some exceptions // if it failed. So we mustn't check any reference here... @@ -559,7 +558,7 @@ void FilterCache::removeStatePropsFromItem(CacheItem& rItem) void FilterCache::flush() { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // renew all dependencies and optimizations impl_validateAndOptimize(); @@ -661,7 +660,7 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL , sExtension = sExtension.toAsciiLowerCase(); // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // i) Step over all well known URL pattern @@ -710,7 +709,7 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL , const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); switch(eType) { @@ -729,7 +728,7 @@ const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const CacheItemList& FilterCache::impl_getItemList(EItemType eType) { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); switch(eType) { @@ -747,7 +746,7 @@ CacheItemList& FilterCache::impl_getItemList(EItemType eType) css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider) { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); OUString sPath ; css::uno::Reference< css::uno::XInterface >* pConfig = nullptr; @@ -873,7 +872,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess bool bLocalesMode) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); css::uno::Reference< css::uno::XInterface > xCfg; @@ -933,7 +932,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess void FilterCache::impl_validateAndOptimize() { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // First check if any filter or type could be read // from the underlying configuration! @@ -1260,7 +1259,7 @@ FilterCache::EItemFlushState FilterCache::impl_specifyFlushOperation(const css:: void FilterCache::impl_load(EFillState eRequiredState) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // Attention: Detect services are part of the standard set! // So there is no need to handle it separately. @@ -1473,7 +1472,7 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe { // SAFE -> ---------------------------------- - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); OUString sActLocale = m_sActLocale ; aLock.clear(); // <- SAFE ---------------------------------- @@ -2204,7 +2203,7 @@ bool FilterCache::impl_isModuleInstalled(const OUString& sModule) // SAFE -> { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); if (!m_xModuleCfg.is()) { m_xModuleCfg = officecfg::Setup::Office::Factories::get(); diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index a0ef79c93931..42be4314cb38 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -29,6 +29,7 @@ #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Any.h> #include <comphelper/documentconstants.hxx> +#include <cppuhelper/basemutex.hxx> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> @@ -54,7 +55,7 @@ class CacheUpdateListener; Further we make it public. So any user of this class can lock us from outside too. */ -class FilterCache : public BaseLock +class FilterCache : public cppu::BaseMutex { // public types diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index 8832330d5a04..6bcb0cc4e326 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -77,7 +77,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan const css::uno::Sequence< css::uno::Any >& lArguments) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); auto & cache = GetTheFilterCache(); @@ -167,7 +167,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea { // SAFE -> ---------------------- { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // May be not all filters was loaded ... // But we need it now! impl_loadOnDemand(); @@ -253,7 +253,7 @@ std::vector<OUString> FilterFactory::impl_queryMatchByDocumentService(const Quer nEFlags = pIt->second.toInt32(); // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); // search suitable filters FilterCache* pCache = impl_getWorkingCache(); @@ -409,7 +409,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterList(const QueryTokeniz std::vector<OUString> FilterFactory::impl_getListOfInstalledModules() const { // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aLock.clear(); // <- SAFE ---------------------- @@ -431,7 +431,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS lIProps[PROPNAME_DOCUMENTSERVICE] <<= sModule; // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); FilterCache* pCache = impl_getWorkingCache(); std::vector<OUString> lOtherFilters = pCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps); aLock.clear(); @@ -472,7 +472,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) const { // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aLock.clear(); // <- SAFE ---------------------- diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx index a3aef82e4c6c..3627ea93faa1 100644 --- a/filter/source/config/cache/frameloaderfactory.cxx +++ b/filter/source/config/cache/frameloaderfactory.cxx @@ -51,7 +51,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI const css::uno::Sequence< css::uno::Any >& lArguments) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); auto & cache = GetTheFilterCache(); diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 9f80798a8cb7..ac4d9aed9f2a 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -72,7 +72,7 @@ OUString SAL_CALL TypeDetection::queryTypeByURL(const OUString& sURL) OUString sType; // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); css::util::URL aURL; aURL.Complete = sURL; @@ -377,7 +377,7 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css:: try { // SAFE -> ---------------------------------- - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); // parse given URL to split it into e.g. main and jump marks ... sURL = stlDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString()); @@ -487,7 +487,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes OUString sRealType = sType; // SAFE -> - ::osl::ResettableMutexGuard aLock(m_aLock); + ::osl::ResettableMutexGuard aLock(m_aMutex); // Attention: For executing next lines of code, We must be sure that // all filters already loaded :-( @@ -545,7 +545,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes try { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); CacheItem aType = cache.getItem(FilterCache::E_TYPE, sType); aType[PROPNAME_PREFERREDFILTER] >>= sFilter; @@ -568,7 +568,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes try { // SAFE -> - ::osl::ResettableMutexGuard aLock(m_aLock); + ::osl::ResettableMutexGuard aLock(m_aMutex); // Attention: For executing next lines of code, We must be sure that // all filters already loaded :-( @@ -640,7 +640,7 @@ bool TypeDetection::impl_getPreselectionForType( try { // SAFE -> -------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sType); // <- SAFE -------------------------- } @@ -726,7 +726,7 @@ void TypeDetection::impl_getPreselectionForDocumentService( try { // SAFE -> -------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // Attention: For executing next lines of code, We must be sure that // all filters already loaded :-( @@ -764,7 +764,7 @@ OUString TypeDetection::impl_getTypeFromFilter(const OUString& rFilterName) CacheItem aFilter; try { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); aFilter = GetTheFilterCache().getItem(FilterCache::E_FILTER, rFilterName); } catch (const container::NoSuchElementException&) @@ -786,7 +786,7 @@ void TypeDetection::impl_getAllFormatTypes( std::vector<OUString> aFilterNames; try { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); auto & cache = GetTheFilterCache(); cache.load(FilterCache::E_CONTAINS_FILTERS); aFilterNames = cache.getItemNames(FilterCache::E_FILTER); @@ -896,7 +896,7 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& r try { // SAFE -> ---------------------------------- - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); CacheItem aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sFlatType); aLock.clear(); @@ -974,7 +974,7 @@ OUString TypeDetection::impl_askDetectService(const OUString& sDet // SAFE -> { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); xContext = m_xContext; } // <- SAFE @@ -1147,7 +1147,7 @@ bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescript { // SAFE -> { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType)) { rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] <<= sType; @@ -1168,7 +1168,7 @@ bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescri try { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); auto & cache = GetTheFilterCache(); CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter); diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx index 183c097fed0e..6b1321a03f05 100644 --- a/include/editeng/AccessibleContextBase.hxx +++ b/include/editeng/AccessibleContextBase.hxx @@ -27,6 +27,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <osl/mutex.hxx> #include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> #include <editeng/editengdllapi.h> namespace com::sun::star::accessibility { class XAccessibleStateSet; } @@ -35,8 +36,6 @@ namespace com::sun::star::accessibility { struct AccessibleEventObject; } namespace accessibility { -struct MutexOwner {mutable ::osl::Mutex maMutex;}; - /** @descr This base class provides an implementation of the AccessibleContext service. Apart from the @@ -44,7 +43,7 @@ struct MutexOwner {mutable ::osl::Mutex maMutex;}; interfaces it supports the XServiceInfo interface. */ class EDITENG_DLLPUBLIC AccessibleContextBase - : public MutexOwner, + : public cppu::BaseMutex, public cppu::WeakComponentImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleContext, diff --git a/include/svtools/acceleratorexecute.hxx b/include/svtools/acceleratorexecute.hxx index 56fb1c4c627c..f43fefe43507 100644 --- a/include/svtools/acceleratorexecute.hxx +++ b/include/svtools/acceleratorexecute.hxx @@ -38,12 +38,6 @@ namespace svt { -struct TMutexInit -{ - ::osl::Mutex m_aLock; -}; - - /** @descr implements a helper, which can be used to convert vcl key codes into awt key codes ... @@ -67,10 +61,11 @@ struct TMutexInit Of course this queue will be stopped if the environment will be destructed... */ -class SVT_DLLPUBLIC AcceleratorExecute final : private TMutexInit +class SVT_DLLPUBLIC AcceleratorExecute final { // member private: + ::osl::Mutex m_aLock; /** TODO document me */ css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/include/vcl/unohelp2.hxx b/include/vcl/unohelp2.hxx index a92859885cbe..c4aad4c606b1 100644 --- a/include/vcl/unohelp2.hxx +++ b/include/vcl/unohelp2.hxx @@ -62,14 +62,6 @@ namespace vcl::unohelper { ); }; - struct MutexHelper - { - private: - ::osl::Mutex maMutex; - public: - ::osl::Mutex& GetMutex() { return maMutex; } - }; - } // namespace vcl::unohelper #endif // INCLUDED_VCL_UNOHELP2_HXX diff --git a/javaunohelper/source/vm.cxx b/javaunohelper/source/vm.cxx index b3643acc78e2..c5f2c577417a 100644 --- a/javaunohelper/source/vm.cxx +++ b/javaunohelper/source/vm.cxx @@ -26,20 +26,17 @@ #include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <cppuhelper/compbase.hxx> #include <cppuhelper/component_context.hxx> +#include <cppuhelper/basemutex.hxx> #include <jvmaccess/virtualmachine.hxx> #include <jvmaccess/unovirtualmachine.hxx> #include <osl/mutex.hxx> namespace { -struct MutexHolder -{ - ::osl::Mutex m_mutex; -}; typedef ::cppu::WeakComponentImplHelper< css::lang::XSingleComponentFactory > t_impl; -class SingletonFactory : public MutexHolder, public t_impl +class SingletonFactory : public cppu::BaseMutex, public t_impl { ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > m_vm_access; @@ -48,7 +45,7 @@ protected: public: explicit SingletonFactory( ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > const & vm_access ) - : t_impl( m_mutex ), + : t_impl( m_aMutex ), m_vm_access( vm_access ) {} diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index ef1d1240c315..5a84029cb534 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -240,7 +240,7 @@ Reference<XAccessible> SAL_CALL { ThrowIfDisposed (); - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); if (mxAccessibleOLEObject.is()) if (nIndex == 0) return mxAccessibleOLEObject; @@ -260,7 +260,7 @@ uno::Reference<XAccessible > SAL_CALL { ThrowIfDisposed (); - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); uno::Reference<XAccessible> xChildAtPosition; sal_Int32 nChildCount = getAccessibleChildCount (); @@ -604,7 +604,7 @@ void AccessibleDocumentViewBase::SetAccessibleOLEObject ( // Assume that the accessible OLE Object disposes itself correctly. { - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); mxAccessibleOLEObject = xOLEObject; } @@ -622,7 +622,7 @@ void AccessibleDocumentViewBase::SetAccessibleOLEObject ( ::osl::Mutex& AccessibleDocumentViewBase::implGetMutex() { - return maMutex; + return m_aMutex; } // return ourself as context in default case @@ -647,7 +647,7 @@ void uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() { - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); uno::Any anyAttribute; OUStringBuffer sValue; @@ -766,7 +766,7 @@ sal_Int32 SAL_CALL AccessibleDocumentViewBase::getForeground( ) sal_Int32 SAL_CALL AccessibleDocumentViewBase::getBackground( ) { ThrowIfDisposed (); - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); return sal_Int32(mpViewShell->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor); } } // end of namespace accessibility diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index 260a41a118d1..4d5524ac8c3e 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -202,7 +202,7 @@ uno::Reference<XAccessible> SAL_CALL { ThrowIfDisposed (); - ::osl::ClearableMutexGuard aGuard (maMutex); + ::osl::ClearableMutexGuard aGuard (m_aMutex); // Take care of children of the base class. sal_Int32 nCount = AccessibleDocumentViewBase::getAccessibleChildCount(); diff --git a/sfx2/inc/preventduplicateinteraction.hxx b/sfx2/inc/preventduplicateinteraction.hxx index b3259aa4ed80..f5a92ca7dd36 100644 --- a/sfx2/inc/preventduplicateinteraction.hxx +++ b/sfx2/inc/preventduplicateinteraction.hxx @@ -151,15 +151,10 @@ public: On the other side there exists some interactions, which allow a retry. So this helper allow to set a list of interactions combined with a retry value. */ -struct ThreadHelpBase2 -{ - public: - mutable ::osl::Mutex m_aLock; -}; - -class PreventDuplicateInteraction final : private ThreadHelpBase2 - , public ::cppu::WeakImplHelper<css::lang::XInitialization, css::task::XInteractionHandler2> +class PreventDuplicateInteraction final : + public ::cppu::WeakImplHelper<css::lang::XInitialization, css::task::XInteractionHandler2> { + mutable ::osl::Mutex m_aLock; // structs, types etc. public: diff --git a/sfx2/source/appl/preventduplicateinteraction.cxx b/sfx2/source/appl/preventduplicateinteraction.cxx index a80b05c44929..0c32b34f3503 100644 --- a/sfx2/source/appl/preventduplicateinteraction.cxx +++ b/sfx2/source/appl/preventduplicateinteraction.cxx @@ -28,8 +28,7 @@ namespace sfx2 { PreventDuplicateInteraction::PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext) - : ThreadHelpBase2() - , m_xContext(rxContext) + : m_xContext(rxContext) { } diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index a378587fd8e5..9fa76e56deaf 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -85,7 +85,6 @@ class AsyncAccelExec : public cppu::WeakImplHelper<css::lang::XEventListener> } AcceleratorExecute::AcceleratorExecute() - : TMutexInit() { } diff --git a/svx/inc/AccessibleTableShape.hxx b/svx/inc/AccessibleTableShape.hxx index 6fe03c15363b..16dcf4fe38ae 100644 --- a/svx/inc/AccessibleTableShape.hxx +++ b/svx/inc/AccessibleTableShape.hxx @@ -142,7 +142,7 @@ typedef ::cppu::WeakImplHelper< css::accessibility::XAccessibleTableSelection > AccessibleTableHeaderShape_BASE; -class AccessibleTableHeaderShape final : public MutexOwner, +class AccessibleTableHeaderShape final : public cppu::BaseMutex, public AccessibleTableHeaderShape_BASE { public: diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx index f2714a8ab9b0..79abed1a0d1a 100644 --- a/svx/source/accessibility/AccessibleControlShape.cxx +++ b/svx/source/accessibility/AccessibleControlShape.cxx @@ -357,7 +357,7 @@ IMPLEMENT_GET_IMPLEMENTATION_ID( AccessibleControlShape ) void SAL_CALL AccessibleControlShape::propertyChange( const PropertyChangeEvent& _rEvent ) { - ::osl::MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( m_aMutex ); // check if it is the name or the description if ( _rEvent.PropertyName == lcl_getNamePropertyName() @@ -427,7 +427,7 @@ void SAL_CALL AccessibleControlShape::notifyEvent( const AccessibleEventObject& AccessibleEventObject aTranslatedEvent( _rEvent ); { - ::osl::MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( m_aMutex ); // let the child manager translate the event aTranslatedEvent.Source = *this; diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 821fd27864c0..8985e9cba6de 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -359,7 +359,7 @@ uno::Reference<XAccessible> SAL_CALL uno::Reference<XAccessibleRelationSet> SAL_CALL AccessibleShape::getAccessibleRelationSet() { - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); if (mpParent == nullptr) return uno::Reference<XAccessibleRelationSet>(); @@ -384,7 +384,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL uno::Reference<XAccessibleStateSet> SAL_CALL AccessibleShape::getAccessibleStateSet() { - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); if (IsDisposed()) { @@ -456,7 +456,7 @@ uno::Reference<XAccessible > SAL_CALL AccessibleShape::getAccessibleAtPoint ( const awt::Point& aPoint) { - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); sal_Int32 nChildCount = getAccessibleChildCount (); for (sal_Int32 i=0; i<nChildCount; ++i) @@ -487,7 +487,7 @@ uno::Reference<XAccessible > SAL_CALL awt::Rectangle SAL_CALL AccessibleShape::getBounds() { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); ThrowIfDisposed (); awt::Rectangle aBoundingBox; @@ -896,7 +896,7 @@ uno::Sequence<uno::Type> SAL_CALL void AccessibleShape::disposing (const lang::EventObject& aEvent) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); try { @@ -1011,7 +1011,7 @@ OUString AccessibleShape::GetFullAccessibleName (AccessibleShape *shape) void AccessibleShape::disposing() { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); // Make sure to send an event that this object loses the focus in the // case that it has the focus. diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 4d474a4953fa..2b8f5674b0d9 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -71,7 +71,7 @@ ChildrenManagerImpl::ChildrenManagerImpl ( AccessibleContextBase& rContext) : ::cppu::WeakComponentImplHelper< css::document::XEventListener, - css::view::XSelectionChangeListener>(maMutex), + css::view::XSelectionChangeListener>(m_aMutex), mxShapeList (rxShapeList), mxParent (rxParent), maShapeTreeInfo (rShapeTreeInfo), diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx index 5520a4947b32..1956a7650fc4 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.hxx +++ b/svx/source/accessibility/ChildrenManagerImpl.hxx @@ -72,7 +72,7 @@ typedef ::std::vector<ChildDescriptor> ChildDescriptorListType; @see ChildrenManager */ class ChildrenManagerImpl final - : public MutexOwner, + : public cppu::BaseMutex, public cppu::WeakComponentImplHelper< css::document::XEventListener, css::view::XSelectionChangeListener>, diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index d298555734ba..127d6b7fb742 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -181,7 +181,7 @@ Reference<XAccessible> SAL_CALL AccessibleCell::getAccessibleChild (sal_Int32 nI Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet() { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); Reference<XAccessibleStateSet> xStateSet; if (rBHelper.bDisposed || mpText == nullptr) @@ -261,7 +261,7 @@ sal_Bool SAL_CALL AccessibleCell::containsPoint( const css::awt::Point& aPoint) Reference<XAccessible > SAL_CALL AccessibleCell::getAccessibleAtPoint ( const css::awt::Point& aPoint) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); sal_Int32 nChildCount = getAccessibleChildCount (); for (sal_Int32 i=0; i<nChildCount; ++i) @@ -291,7 +291,7 @@ Reference<XAccessible > SAL_CALL AccessibleCell::getAccessibleAtPoint ( const c css::awt::Rectangle SAL_CALL AccessibleCell::getBounds() { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); ThrowIfDisposed (); css::awt::Rectangle aBoundingBox; @@ -426,7 +426,7 @@ OUString SAL_CALL AccessibleCell::getToolTipText() void SAL_CALL AccessibleCell::addAccessibleEventListener( const Reference<XAccessibleEventListener >& rxListener) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); if (rBHelper.bDisposed || rBHelper.bInDispose) { Reference<XInterface> xSource( static_cast<XComponent *>(this) ); @@ -489,7 +489,7 @@ void AccessibleCell::ViewForwarderChanged() void AccessibleCell::disposing() { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard (maMutex); + ::osl::MutexGuard aGuard (m_aMutex); // Make sure to send an event that this object loses the focus in the // case that it has the focus. diff --git a/ucb/source/ucp/expand/ucpexpand.cxx b/ucb/source/ucp/expand/ucpexpand.cxx index aa2f7a87dd2e..5b880a3d2a4d 100644 --- a/ucb/source/ucp/expand/ucpexpand.cxx +++ b/ucb/source/ucp/expand/ucpexpand.cxx @@ -22,6 +22,7 @@ #include <osl/mutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/factory.hxx> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/supportsservice.hxx> #include <ucbhelper/content.hxx> @@ -41,16 +42,11 @@ using namespace ::com::sun::star; namespace { -struct MutexHolder -{ - mutable ::osl::Mutex m_mutex; -}; - typedef ::cppu::WeakComponentImplHelper< lang::XServiceInfo, ucb::XContentProvider > t_impl_helper; -class ExpandContentProviderImpl : protected MutexHolder, public t_impl_helper +class ExpandContentProviderImpl : protected cppu::BaseMutex, public t_impl_helper { uno::Reference< uno::XComponentContext > m_xComponentContext; uno::Reference< util::XMacroExpander > m_xMacroExpander; @@ -64,7 +60,7 @@ protected: public: explicit ExpandContentProviderImpl( uno::Reference< uno::XComponentContext > const & xComponentContext ) - : t_impl_helper( m_mutex ), + : t_impl_helper( m_aMutex ), m_xComponentContext( xComponentContext ), m_xMacroExpander( util::theMacroExpander::get(xComponentContext) ) {} diff --git a/vcl/inc/dndlistenercontainer.hxx b/vcl/inc/dndlistenercontainer.hxx index 28339e7abeb8..1e23dfa6c9bc 100644 --- a/vcl/inc/dndlistenercontainer.hxx +++ b/vcl/inc/dndlistenercontainer.hxx @@ -26,10 +26,9 @@ #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> #include <com/sun/star/datatransfer/dnd/XDropTargetDropContext.hpp> #include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> -#include <vcl/unohelp2.hxx> - -class DNDListenerContainer final : public vcl::unohelper::MutexHelper, +class DNDListenerContainer final : public cppu::BaseMutex, public ::cppu::WeakComponentImplHelper< css::datatransfer::dnd::XDragGestureRecognizer, css::datatransfer::dnd::XDropTargetDragContext, diff --git a/vcl/source/window/dndlistenercontainer.cxx b/vcl/source/window/dndlistenercontainer.cxx index 5d430629c254..7e38dae842f2 100644 --- a/vcl/source/window/dndlistenercontainer.cxx +++ b/vcl/source/window/dndlistenercontainer.cxx @@ -25,7 +25,7 @@ using namespace ::com::sun::star::datatransfer; using namespace ::com::sun::star::datatransfer::dnd; DNDListenerContainer::DNDListenerContainer( sal_Int8 nDefaultActions ) - : WeakComponentImplHelper< XDragGestureRecognizer, XDropTargetDragContext, XDropTargetDropContext, XDropTarget >(GetMutex()) + : WeakComponentImplHelper< XDragGestureRecognizer, XDropTargetDragContext, XDropTargetDropContext, XDropTarget >(m_aMutex) { m_bActive = true; m_nDefaultActions = nDefaultActions; diff --git a/vcl/win/dtrans/globals.hxx b/vcl/win/dtrans/globals.hxx index 69e9f2d15597..9bb174d0b6b8 100644 --- a/vcl/win/dtrans/globals.hxx +++ b/vcl/win/dtrans/globals.hxx @@ -65,11 +65,6 @@ DWORD dndActionsToDropEffects(sal_Int8 actions); // or Alt). DWORD dndActionsToSingleDropEffect(sal_Int8 actions); -struct MutexDummy -{ - osl::Mutex m_mutex; -}; - extern css::uno::Reference<css::datatransfer::XTransferable> g_XTransferable; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/source.cxx b/vcl/win/dtrans/source.cxx index fdbb295e33da..d8143a3791c9 100644 --- a/vcl/win/dtrans/source.cxx +++ b/vcl/win/dtrans/source.cxx @@ -51,7 +51,7 @@ using namespace com::sun::star::lang; static unsigned __stdcall DndOleSTAFunc(LPVOID pParams); DragSource::DragSource( const Reference<XComponentContext>& rxContext): - WeakComponentImplHelper< XDragSource, XInitialization, XServiceInfo >(m_mutex), + WeakComponentImplHelper< XDragSource, XInitialization, XServiceInfo >(m_aMutex), m_xContext( rxContext ), // m_pcurrentContext_impl(0), m_hAppWindow(nullptr), diff --git a/vcl/win/dtrans/source.hxx b/vcl/win/dtrans/source.hxx index 44244839869f..f2124932be79 100644 --- a/vcl/win/dtrans/source.hxx +++ b/vcl/win/dtrans/source.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <osl/mutex.hxx> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include "globals.hxx" @@ -43,7 +44,7 @@ class SourceContext; // RIGHT MOUSE BUTTON drag and drop not supported currently. // ALT modifier is considered to effect a user selection of effects class DragSource: - public MutexDummy, + public cppu::BaseMutex, public WeakComponentImplHelper<XDragSource, XInitialization, XServiceInfo>, public IDropSource diff --git a/vcl/win/dtrans/sourcecontext.cxx b/vcl/win/dtrans/sourcecontext.cxx index 8531fd8a1184..c0e6371c5b41 100644 --- a/vcl/win/dtrans/sourcecontext.cxx +++ b/vcl/win/dtrans/sourcecontext.cxx @@ -26,7 +26,7 @@ using namespace com::sun::star::datatransfer::dnd::DNDConstants; SourceContext::SourceContext( DragSource* pSource, const Reference<XDragSourceListener>& listener): - WeakComponentImplHelper<XDragSourceContext>(m_mutex), + WeakComponentImplHelper<XDragSourceContext>(m_aMutex), m_pDragSource( pSource), m_dragSource( static_cast<XDragSource*>( m_pDragSource) ) { diff --git a/vcl/win/dtrans/sourcecontext.hxx b/vcl/win/dtrans/sourcecontext.hxx index 9bc9e273cc7f..b6ed4a90c906 100644 --- a/vcl/win/dtrans/sourcecontext.hxx +++ b/vcl/win/dtrans/sourcecontext.hxx @@ -20,6 +20,7 @@ #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> #include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> #include "source.hxx" @@ -35,7 +36,7 @@ using namespace ::com::sun::star::lang; // currently. // An instance of SourceContext only lives as long as the drag and drop // operation lasts. -class SourceContext : public MutexDummy, public WeakComponentImplHelper<XDragSourceContext> +class SourceContext : public cppu::BaseMutex, public WeakComponentImplHelper<XDragSourceContext> { DragSource* m_pDragSource; Reference<XDragSource> m_dragSource; diff --git a/vcl/win/dtrans/target.cxx b/vcl/win/dtrans/target.cxx index 8f48cd2d2bec..a4ad523e34ee 100644 --- a/vcl/win/dtrans/target.cxx +++ b/vcl/win/dtrans/target.cxx @@ -47,7 +47,7 @@ using namespace com::sun::star::datatransfer::dnd::DNDConstants; DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams); DropTarget::DropTarget( const Reference<XComponentContext>& rxContext): - WeakComponentImplHelper<XInitialization,XDropTarget, XServiceInfo>(m_mutex), + WeakComponentImplHelper<XInitialization,XDropTarget, XServiceInfo>(m_aMutex), m_hWnd( nullptr), m_threadIdWindow(0), m_threadIdTarget(0), @@ -291,7 +291,7 @@ sal_Bool SAL_CALL DropTarget::isActive( ) void SAL_CALL DropTarget::setActive( sal_Bool _b ) { - MutexGuard g(m_mutex); + MutexGuard g(m_aMutex); m_bActive= _b; } diff --git a/vcl/win/dtrans/target.hxx b/vcl/win/dtrans/target.hxx index 0e3da70d7e5c..36dcbc8c1141 100644 --- a/vcl/win/dtrans/target.hxx +++ b/vcl/win/dtrans/target.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <osl/mutex.hxx> @@ -49,7 +50,7 @@ using namespace ::com::sun::star::datatransfer::dnd; // If the service calls OleInitialize then it also calls OleUnitialize when // it is destroyed. Therefore no second instance may exist which was // created in the same thread and still needs OLE. -class DropTarget : public MutexDummy, +class DropTarget : public cppu::BaseMutex, public WeakComponentImplHelper<XInitialization, XDropTarget, XServiceInfo> { |