use more cppu::BaseMutex

Change-Id: Iddd7438161ead93b27cf8e8058ca5b1eae3d8001
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127075
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2021-12-17 22:42:53 +02:00
committed by Noel Grandin
parent 729834abac
commit 3152f5a33e
45 changed files with 138 additions and 195 deletions

View File

@@ -27,6 +27,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <cppuhelper/component.hxx> #include <cppuhelper/component.hxx>
#include <cppuhelper/basemutex.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
namespace com::sun::star::uno { class XComponentContext; } namespace com::sun::star::uno { class XComponentContext; }
@@ -39,19 +40,13 @@ namespace unocontrols { class OMRCListenerMultiplexerHelper; }
namespace unocontrols { 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 class BaseControl : public css::lang::XServiceInfo
, public css::awt::XPaintListener , public css::awt::XPaintListener
, public css::awt::XWindowListener , public css::awt::XWindowListener
, public css::awt::XView , public css::awt::XView
, public css::awt::XWindow , public css::awt::XWindow
, public css::awt::XControl , public css::awt::XControl
, public IMPL_MutexContainer , public cppu::BaseMutex
, public ::cppu::OComponentHelper , public ::cppu::OComponentHelper
{ {
public: public:

View File

@@ -49,8 +49,7 @@ namespace unocontrols {
// construct/destruct // construct/destruct
BaseControl::BaseControl( const Reference< XComponentContext >& rxContext ) BaseControl::BaseControl( const Reference< XComponentContext >& rxContext )
: IMPL_MutexContainer ( ) : OComponentHelper ( m_aMutex )
, OComponentHelper ( m_aMutex )
, m_xComponentContext ( rxContext ) , m_xComponentContext ( rxContext )
, m_nX ( DEFAULT_X ) , m_nX ( DEFAULT_X )
, m_nY ( DEFAULT_Y ) , m_nY ( DEFAULT_Y )

View File

@@ -21,6 +21,7 @@
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XOfficeInstallationDirectories.hpp> #include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
@@ -37,12 +38,7 @@ typedef cppu::WeakImplHelper<
css::util::XOfficeInstallationDirectories, css::util::XOfficeInstallationDirectories,
css::lang::XServiceInfo > UnoImplBase; css::lang::XServiceInfo > UnoImplBase;
struct mutex_holder class OfficeInstallationDirectories : public cppu::BaseMutex, public UnoImplBase
{
osl::Mutex m_aMutex;
};
class OfficeInstallationDirectories : public mutex_holder, public UnoImplBase
{ {
public: public:
explicit OfficeInstallationDirectories( explicit OfficeInstallationDirectories(

View File

@@ -39,6 +39,7 @@
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <sal/macros.h> #include <sal/macros.h>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -54,7 +55,6 @@ namespace pq_sdbc_driver
SAL_STRINGIFY(PQ_SDBC_MINOR) "." \ SAL_STRINGIFY(PQ_SDBC_MINOR) "." \
SAL_STRINGIFY(PQ_SDBC_MICRO) SAL_STRINGIFY(PQ_SDBC_MICRO)
struct MutexHolder { osl::Mutex m_mutex; };
// use this to switch off sdbc support ! // use this to switch off sdbc support !
// typedef cppu::WeakComponentImplHelper< // typedef cppu::WeakComponentImplHelper<
// css::sdbc::XDriver, // css::sdbc::XDriver,
@@ -64,14 +64,14 @@ typedef cppu::WeakComponentImplHelper<
css::sdbc::XDriver, css::sdbc::XDriver,
css::lang::XServiceInfo, css::lang::XServiceInfo,
css::sdbcx::XDataDefinitionSupplier > DriverBase ; 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::uno::XComponentContext > m_ctx;
css::uno::Reference< css::lang::XMultiComponentFactory > m_smgr; css::uno::Reference< css::lang::XMultiComponentFactory > m_smgr;
public: public:
explicit Driver ( const css::uno::Reference < css::uno::XComponentContext > & ctx ) explicit Driver ( const css::uno::Reference < css::uno::XComponentContext > & ctx )
: DriverBase( m_mutex ), : DriverBase( m_aMutex ),
m_ctx( ctx ), m_ctx( ctx ),
m_smgr( ctx->getServiceManager() ) m_smgr( ctx->getServiceManager() )
{} {}

View File

@@ -45,7 +45,7 @@ namespace accessibility {
AccessibleContextBase::AccessibleContextBase ( AccessibleContextBase::AccessibleContextBase (
const uno::Reference<XAccessible>& rxParent, const uno::Reference<XAccessible>& rxParent,
const sal_Int16 aRole) const sal_Int16 aRole)
: WeakComponentImplHelper(MutexOwner::maMutex), : WeakComponentImplHelper(m_aMutex),
mxParent(rxParent), mxParent(rxParent),
meDescriptionOrigin(NotSet), meDescriptionOrigin(NotSet),
meNameOrigin(NotSet), meNameOrigin(NotSet),
@@ -75,7 +75,7 @@ AccessibleContextBase::~AccessibleContextBase()
bool AccessibleContextBase::SetState (sal_Int16 aState) bool AccessibleContextBase::SetState (sal_Int16 aState)
{ {
::osl::ClearableMutexGuard aGuard (maMutex); ::osl::ClearableMutexGuard aGuard (m_aMutex);
::utl::AccessibleStateSetHelper* pStateSet = ::utl::AccessibleStateSetHelper* pStateSet =
static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
if ((pStateSet != nullptr) && !pStateSet->contains(aState)) if ((pStateSet != nullptr) && !pStateSet->contains(aState))
@@ -104,7 +104,7 @@ bool AccessibleContextBase::SetState (sal_Int16 aState)
bool AccessibleContextBase::ResetState (sal_Int16 aState) bool AccessibleContextBase::ResetState (sal_Int16 aState)
{ {
::osl::ClearableMutexGuard aGuard (maMutex); ::osl::ClearableMutexGuard aGuard (m_aMutex);
::utl::AccessibleStateSetHelper* pStateSet = ::utl::AccessibleStateSetHelper* pStateSet =
static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
if ((pStateSet != nullptr) && pStateSet->contains(aState)) if ((pStateSet != nullptr) && pStateSet->contains(aState))
@@ -128,7 +128,7 @@ bool AccessibleContextBase::ResetState (sal_Int16 aState)
bool AccessibleContextBase::GetState (sal_Int16 aState) bool AccessibleContextBase::GetState (sal_Int16 aState)
{ {
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
::utl::AccessibleStateSetHelper* pStateSet = ::utl::AccessibleStateSetHelper* pStateSet =
static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
if (pStateSet != nullptr) if (pStateSet != nullptr)
@@ -415,7 +415,7 @@ void SAL_CALL AccessibleContextBase::disposing()
{ {
SetState (AccessibleStateType::DEFUNC); SetState (AccessibleStateType::DEFUNC);
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
// Send a disposing to all listeners. // Send a disposing to all listeners.
if ( mnClientId ) if ( mnClientId )

View File

@@ -35,8 +35,7 @@
namespace extensions::config::ldap { namespace extensions::config::ldap {
LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContext>& xContext) LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContext>& xContext)
: LdapProfileMutexHolder(), : BackendBase(m_aMutex)
BackendBase(mMutex)
{ {
LdapDefinition aDefinition; LdapDefinition aDefinition;
OUString loggedOnUser; OUString loggedOnUser;

View File

@@ -23,6 +23,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include "ldapaccess.hxx" #include "ldapaccess.hxx"
@@ -41,13 +42,12 @@ struct LdapDefinition;
typedef cppu::WeakComponentImplHelper<css::beans::XPropertySet, typedef cppu::WeakComponentImplHelper<css::beans::XPropertySet,
lang::XServiceInfo> BackendBase ; lang::XServiceInfo> BackendBase ;
struct LdapProfileMutexHolder { osl::Mutex mMutex; };
/** /**
Implements the PlatformBackend service, a specialization of the Implements the PlatformBackend service, a specialization of the
XPropertySet service for retrieving LDAP user profile XPropertySet service for retrieving LDAP user profile
configuration settings from an LDAP repository. configuration settings from an LDAP repository.
*/ */
class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase class LdapUserProfileBe : private cppu::BaseMutex, public BackendBase
{ {
public: public:

View File

@@ -33,9 +33,8 @@
namespace filter::config{ namespace filter::config{
BaseContainer::BaseContainer() BaseContainer::BaseContainer()
: BaseLock ( ) : m_eType()
, m_eType() , m_lListener (m_aMutex)
, m_lListener (m_aLock)
{ {
GetTheFilterCache().load(FilterCache::E_CONTAINS_STANDARD); GetTheFilterCache().load(FilterCache::E_CONTAINS_STANDARD);
} }
@@ -52,7 +51,7 @@ void BaseContainer::init(const css::uno::Reference< css::uno::XComponentContext
FilterCache::EItemType eType ) FilterCache::EItemType eType )
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
m_sImplementationName = sImplementationName; m_sImplementationName = sImplementationName;
m_lServiceNames = lServiceNames ; m_lServiceNames = lServiceNames ;
@@ -66,7 +65,7 @@ void BaseContainer::impl_loadOnDemand()
{ {
#ifdef LOAD_IMPLICIT #ifdef LOAD_IMPLICIT
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// A generic container needs all items of a set of our cache! // 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. // 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() void BaseContainer::impl_initFlushMode()
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
if (!m_pFlushCache) if (!m_pFlushCache)
m_pFlushCache = GetTheFilterCache().clone(); m_pFlushCache = GetTheFilterCache().clone();
if (!m_pFlushCache) if (!m_pFlushCache)
@@ -114,7 +113,7 @@ void BaseContainer::impl_initFlushMode()
FilterCache* BaseContainer::impl_getWorkingCache() const FilterCache* BaseContainer::impl_getWorkingCache() const
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
if (m_pFlushCache) if (m_pFlushCache)
return m_pFlushCache.get(); return m_pFlushCache.get();
else else
@@ -161,7 +160,7 @@ void SAL_CALL BaseContainer::insertByName(const OUString& sItem ,
impl_loadOnDemand(); impl_loadOnDemand();
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// create write copy of used cache on demand ... // create write copy of used cache on demand ...
impl_initFlushMode(); impl_initFlushMode();
@@ -179,7 +178,7 @@ void SAL_CALL BaseContainer::removeByName(const OUString& sItem)
impl_loadOnDemand(); impl_loadOnDemand();
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// create write copy of used cache on demand ... // create write copy of used cache on demand ...
impl_initFlushMode(); impl_initFlushMode();
@@ -211,7 +210,7 @@ void SAL_CALL BaseContainer::replaceByName(const OUString& sItem ,
impl_loadOnDemand(); impl_loadOnDemand();
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// create write copy of used cache on demand ... // create write copy of used cache on demand ...
impl_initFlushMode(); impl_initFlushMode();
@@ -235,7 +234,7 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const OUString& sItem)
impl_loadOnDemand(); impl_loadOnDemand();
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
CacheItem aItem; CacheItem aItem;
try try
@@ -268,7 +267,7 @@ css::uno::Sequence< OUString > SAL_CALL BaseContainer::getElementNames()
impl_loadOnDemand(); impl_loadOnDemand();
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
try try
{ {
@@ -295,7 +294,7 @@ sal_Bool SAL_CALL BaseContainer::hasByName(const OUString& sItem)
impl_loadOnDemand(); impl_loadOnDemand();
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
try try
{ {
@@ -329,7 +328,7 @@ sal_Bool SAL_CALL BaseContainer::hasElements()
impl_loadOnDemand(); impl_loadOnDemand();
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
try try
{ {
@@ -363,7 +362,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea
impl_loadOnDemand(); impl_loadOnDemand();
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
try try
{ {
@@ -403,7 +402,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea
void SAL_CALL BaseContainer::flush() void SAL_CALL BaseContainer::flush()
{ {
// SAFE -> // SAFE ->
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
if (!m_pFlushCache) if (!m_pFlushCache)
throw css::lang::WrappedTargetRuntimeException( throw css::lang::WrappedTargetRuntimeException(

View File

@@ -49,7 +49,7 @@ namespace filter::config {
present by this base class!) was full initialized inside our own present by this base class!) was full initialized inside our own
ctor as first! ctor as first!
*/ */
class BaseContainer : public BaseLock class BaseContainer : public cppu::BaseMutex
, public ::cppu::WeakImplHelper< css::lang::XServiceInfo , , public ::cppu::WeakImplHelper< css::lang::XServiceInfo ,
css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess
css::container::XContainerQuery , css::container::XContainerQuery ,

View File

@@ -30,19 +30,6 @@
namespace filter::config { 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 /** @short represent an item of a FilterCache
instance. instance.

View File

@@ -33,8 +33,7 @@ namespace filter::config{
CacheUpdateListener::CacheUpdateListener(FilterCache &rFilterCache, CacheUpdateListener::CacheUpdateListener(FilterCache &rFilterCache,
const css::uno::Reference< css::uno::XInterface >& xConfigAccess, const css::uno::Reference< css::uno::XInterface >& xConfigAccess,
FilterCache::EItemType eConfigType) FilterCache::EItemType eConfigType)
: BaseLock() : m_rCache(rFilterCache)
, m_rCache(rFilterCache)
, m_xConfig(xConfigAccess) , m_xConfig(xConfigAccess)
, m_eConfigType(eConfigType) , m_eConfigType(eConfigType)
{ {
@@ -47,7 +46,7 @@ CacheUpdateListener::~CacheUpdateListener()
void CacheUpdateListener::startListening() void CacheUpdateListener::startListening()
{ {
// SAFE -> // SAFE ->
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY); css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY);
aLock.clear(); aLock.clear();
// <- SAFE // <- SAFE
@@ -63,7 +62,7 @@ void CacheUpdateListener::startListening()
void CacheUpdateListener::stopListening() void CacheUpdateListener::stopListening()
{ {
// SAFE -> // SAFE ->
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY); css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY);
aLock.clear(); aLock.clear();
// <- SAFE // <- SAFE
@@ -79,7 +78,7 @@ void CacheUpdateListener::stopListening()
void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEvent& aEvent) void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEvent& aEvent)
{ {
// SAFE -> // SAFE ->
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
// disposed ? // disposed ?
if ( ! m_xConfig.is()) 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) void SAL_CALL CacheUpdateListener::disposing(const css::lang::EventObject& aEvent)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
if (aEvent.Source == m_xConfig) if (aEvent.Source == m_xConfig)
m_xConfig.clear(); m_xConfig.clear();
// <- SAFE // <- SAFE

View File

@@ -30,7 +30,7 @@ namespace filter::config {
global filter cache, if the underlying configuration global filter cache, if the underlying configuration
wa changed by other processes. 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 > , public ::cppu::WeakImplHelper< css::util::XChangesListener >
{ {

View File

@@ -26,8 +26,7 @@
namespace filter::config{ namespace filter::config{
ConfigFlush::ConfigFlush() ConfigFlush::ConfigFlush()
: BaseLock ( ) : m_lListener(m_aMutex)
, m_lListener(m_aLock)
{ {
} }

View File

@@ -23,6 +23,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <comphelper/multicontainer2.hxx> #include <comphelper/multicontainer2.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <cppuhelper/basemutex.hxx>
namespace filter::config { namespace filter::config {
@@ -34,7 +35,7 @@ namespace filter::config {
@descr Such refresh listener will be called in case the @descr Such refresh listener will be called in case the
type/filter configuration will be changed at runtime. type/filter configuration will be changed at runtime.
*/ */
class ConfigFlush final : public BaseLock class ConfigFlush final : public cppu::BaseMutex
, public ::cppu::WeakImplHelper< , public ::cppu::WeakImplHelper<
css::util::XRefreshable, css::util::XRefreshable,
css::lang::XServiceInfo css::lang::XServiceInfo

View File

@@ -53,7 +53,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea
css::uno::Reference< css::uno::XInterface > xHandler; css::uno::Reference< css::uno::XInterface > xHandler;
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
auto & cache = GetTheFilterCache(); auto & cache = GetTheFilterCache();

View File

@@ -56,8 +56,7 @@
namespace filter::config{ namespace filter::config{
FilterCache::FilterCache() FilterCache::FilterCache()
: BaseLock ( ) : m_eFillState(E_CONTAINS_NOTHING )
, m_eFillState(E_CONTAINS_NOTHING )
{ {
int i = 0; int i = 0;
OUString sStandardProps[10]; OUString sStandardProps[10];
@@ -119,7 +118,7 @@ FilterCache::~FilterCache()
std::unique_ptr<FilterCache> FilterCache::clone() const std::unique_ptr<FilterCache> FilterCache::clone() const
{ {
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
auto pClone = std::make_unique<FilterCache>(); auto pClone = std::make_unique<FilterCache>();
@@ -151,7 +150,7 @@ std::unique_ptr<FilterCache> FilterCache::clone() const
void FilterCache::takeOver(const FilterCache& rClone) void FilterCache::takeOver(const FilterCache& rClone)
{ {
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// a) // a)
// Don't copy the configuration access points here! // Don't copy the configuration access points here!
@@ -199,7 +198,7 @@ void FilterCache::takeOver(const FilterCache& rClone)
void FilterCache::load(EFillState eRequired) void FilterCache::load(EFillState eRequired)
{ {
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// check if required fill state is already reached ... // check if required fill state is already reached ...
// There is nothing to do then. // There is nothing to do then.
@@ -238,7 +237,7 @@ void FilterCache::load(EFillState eRequired)
bool FilterCache::isFillState(FilterCache::EFillState eState) const bool FilterCache::isFillState(FilterCache::EFillState eState) const
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
return ((m_eFillState & eState) == eState); return ((m_eFillState & eState) == eState);
// <- SAFE // <- SAFE
} }
@@ -249,7 +248,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp
const CacheItem& lEProps) const const CacheItem& lEProps) const
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// search for right list // search for right list
// An exception is thrown - "eType" is unknown. // An exception is thrown - "eType" is unknown.
@@ -279,7 +278,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp
bool FilterCache::hasItems(EItemType eType) const bool FilterCache::hasItems(EItemType eType) const
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// search for right list // search for right list
// An exception is thrown - "eType" is unknown. // 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 std::vector<OUString> FilterCache::getItemNames(EItemType eType) const
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// search for right list // search for right list
// An exception is thrown - "eType" is unknown. // An exception is thrown - "eType" is unknown.
@@ -315,7 +314,7 @@ bool FilterCache::hasItem( EItemType eType,
const OUString& sItem) const OUString& sItem)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// search for right list // search for right list
// An exception is thrown - "eType" is unknown. // An exception is thrown - "eType" is unknown.
@@ -347,7 +346,7 @@ CacheItem FilterCache::getItem( EItemType eType,
const OUString& sItem) const OUString& sItem)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// search for right list // search for right list
// An exception is thrown if "eType" is unknown. // An exception is thrown if "eType" is unknown.
@@ -397,7 +396,7 @@ void FilterCache::removeItem( EItemType eType,
const OUString& sItem) const OUString& sItem)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// search for right list // search for right list
// An exception is thrown - "eType" is unknown. // An exception is thrown - "eType" is unknown.
@@ -418,7 +417,7 @@ void FilterCache::setItem( EItemType eType ,
const CacheItem& aValue) const CacheItem& aValue)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// search for right list // search for right list
// An exception is thrown - "eType" is unknown. // An exception is thrown - "eType" is unknown.
@@ -445,7 +444,7 @@ void FilterCache::refreshItem( EItemType eType,
const OUString& sItem) const OUString& sItem)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
impl_loadItemOnDemand(eType, sItem); impl_loadItemOnDemand(eType, sItem);
} }
@@ -455,7 +454,7 @@ void FilterCache::addStatePropsToItem( EItemType eType,
CacheItem& rItem) CacheItem& rItem)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// Note: Opening of the configuration layer throws some exceptions // Note: Opening of the configuration layer throws some exceptions
// if it failed. So we mustn't check any reference here... // if it failed. So we mustn't check any reference here...
@@ -559,7 +558,7 @@ void FilterCache::removeStatePropsFromItem(CacheItem& rItem)
void FilterCache::flush() void FilterCache::flush()
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// renew all dependencies and optimizations // renew all dependencies and optimizations
impl_validateAndOptimize(); impl_validateAndOptimize();
@@ -661,7 +660,7 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL ,
sExtension = sExtension.toAsciiLowerCase(); sExtension = sExtension.toAsciiLowerCase();
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// i) Step over all well known URL pattern // 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 const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const
{ {
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
switch(eType) switch(eType)
{ {
@@ -729,7 +728,7 @@ const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const
CacheItemList& FilterCache::impl_getItemList(EItemType eType) CacheItemList& FilterCache::impl_getItemList(EItemType eType)
{ {
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
switch(eType) switch(eType)
{ {
@@ -747,7 +746,7 @@ CacheItemList& FilterCache::impl_getItemList(EItemType eType)
css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider) css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider)
{ {
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
OUString sPath ; OUString sPath ;
css::uno::Reference< css::uno::XInterface >* pConfig = nullptr; css::uno::Reference< css::uno::XInterface >* pConfig = nullptr;
@@ -873,7 +872,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess
bool bLocalesMode) bool bLocalesMode)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
css::uno::Reference< css::uno::XInterface > xCfg; css::uno::Reference< css::uno::XInterface > xCfg;
@@ -933,7 +932,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess
void FilterCache::impl_validateAndOptimize() void FilterCache::impl_validateAndOptimize()
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// First check if any filter or type could be read // First check if any filter or type could be read
// from the underlying configuration! // from the underlying configuration!
@@ -1260,7 +1259,7 @@ FilterCache::EItemFlushState FilterCache::impl_specifyFlushOperation(const css::
void FilterCache::impl_load(EFillState eRequiredState) void FilterCache::impl_load(EFillState eRequiredState)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// Attention: Detect services are part of the standard set! // Attention: Detect services are part of the standard set!
// So there is no need to handle it separately. // So there is no need to handle it separately.
@@ -1473,7 +1472,7 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe
{ {
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
OUString sActLocale = m_sActLocale ; OUString sActLocale = m_sActLocale ;
aLock.clear(); aLock.clear();
// <- SAFE ---------------------------------- // <- SAFE ----------------------------------
@@ -2204,7 +2203,7 @@ bool FilterCache::impl_isModuleInstalled(const OUString& sModule)
// SAFE -> // SAFE ->
{ {
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
if (!m_xModuleCfg.is()) if (!m_xModuleCfg.is())
{ {
m_xModuleCfg = officecfg::Setup::Office::Factories::get(); m_xModuleCfg = officecfg::Setup::Office::Factories::get();

View File

@@ -29,6 +29,7 @@
#include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Any.h> #include <com/sun/star/uno/Any.h>
#include <comphelper/documentconstants.hxx> #include <comphelper/documentconstants.hxx>
#include <cppuhelper/basemutex.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
@@ -54,7 +55,7 @@ class CacheUpdateListener;
Further we make it public. So any user of this class Further we make it public. So any user of this class
can lock us from outside too. can lock us from outside too.
*/ */
class FilterCache : public BaseLock class FilterCache : public cppu::BaseMutex
{ {
// public types // public types

View File

@@ -77,7 +77,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan
const css::uno::Sequence< css::uno::Any >& lArguments) const css::uno::Sequence< css::uno::Any >& lArguments)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
auto & cache = GetTheFilterCache(); auto & cache = GetTheFilterCache();
@@ -167,7 +167,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea
{ {
// SAFE -> ---------------------- // SAFE -> ----------------------
{ {
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// May be not all filters was loaded ... // May be not all filters was loaded ...
// But we need it now! // But we need it now!
impl_loadOnDemand(); impl_loadOnDemand();
@@ -253,7 +253,7 @@ std::vector<OUString> FilterFactory::impl_queryMatchByDocumentService(const Quer
nEFlags = pIt->second.toInt32(); nEFlags = pIt->second.toInt32();
// SAFE -> ---------------------- // SAFE -> ----------------------
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
// search suitable filters // search suitable filters
FilterCache* pCache = impl_getWorkingCache(); FilterCache* pCache = impl_getWorkingCache();
@@ -409,7 +409,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterList(const QueryTokeniz
std::vector<OUString> FilterFactory::impl_getListOfInstalledModules() const std::vector<OUString> FilterFactory::impl_getListOfInstalledModules() const
{ {
// SAFE -> ---------------------- // SAFE -> ----------------------
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
aLock.clear(); aLock.clear();
// <- SAFE ---------------------- // <- SAFE ----------------------
@@ -431,7 +431,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS
lIProps[PROPNAME_DOCUMENTSERVICE] <<= sModule; lIProps[PROPNAME_DOCUMENTSERVICE] <<= sModule;
// SAFE -> ---------------------- // SAFE -> ----------------------
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
FilterCache* pCache = impl_getWorkingCache(); FilterCache* pCache = impl_getWorkingCache();
std::vector<OUString> lOtherFilters = pCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps); std::vector<OUString> lOtherFilters = pCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
aLock.clear(); aLock.clear();
@@ -472,7 +472,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS
std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) const std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) const
{ {
// SAFE -> ---------------------- // SAFE -> ----------------------
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
aLock.clear(); aLock.clear();
// <- SAFE ---------------------- // <- SAFE ----------------------

View File

@@ -51,7 +51,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI
const css::uno::Sequence< css::uno::Any >& lArguments) const css::uno::Sequence< css::uno::Any >& lArguments)
{ {
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
auto & cache = GetTheFilterCache(); auto & cache = GetTheFilterCache();

View File

@@ -72,7 +72,7 @@ OUString SAL_CALL TypeDetection::queryTypeByURL(const OUString& sURL)
OUString sType; OUString sType;
// SAFE -> // SAFE ->
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
css::util::URL aURL; css::util::URL aURL;
aURL.Complete = sURL; aURL.Complete = sURL;
@@ -377,7 +377,7 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::
try try
{ {
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
// parse given URL to split it into e.g. main and jump marks ... // parse given URL to split it into e.g. main and jump marks ...
sURL = stlDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString()); sURL = stlDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString());
@@ -487,7 +487,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
OUString sRealType = sType; OUString sRealType = sType;
// SAFE -> // SAFE ->
::osl::ResettableMutexGuard aLock(m_aLock); ::osl::ResettableMutexGuard aLock(m_aMutex);
// Attention: For executing next lines of code, We must be sure that // Attention: For executing next lines of code, We must be sure that
// all filters already loaded :-( // all filters already loaded :-(
@@ -545,7 +545,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
try try
{ {
// SAFE -> // SAFE ->
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
CacheItem aType = cache.getItem(FilterCache::E_TYPE, sType); CacheItem aType = cache.getItem(FilterCache::E_TYPE, sType);
aType[PROPNAME_PREFERREDFILTER] >>= sFilter; aType[PROPNAME_PREFERREDFILTER] >>= sFilter;
@@ -568,7 +568,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
try try
{ {
// SAFE -> // SAFE ->
::osl::ResettableMutexGuard aLock(m_aLock); ::osl::ResettableMutexGuard aLock(m_aMutex);
// Attention: For executing next lines of code, We must be sure that // Attention: For executing next lines of code, We must be sure that
// all filters already loaded :-( // all filters already loaded :-(
@@ -640,7 +640,7 @@ bool TypeDetection::impl_getPreselectionForType(
try try
{ {
// SAFE -> -------------------------- // SAFE -> --------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sType); aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sType);
// <- SAFE -------------------------- // <- SAFE --------------------------
} }
@@ -726,7 +726,7 @@ void TypeDetection::impl_getPreselectionForDocumentService(
try try
{ {
// SAFE -> -------------------------- // SAFE -> --------------------------
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
// Attention: For executing next lines of code, We must be sure that // Attention: For executing next lines of code, We must be sure that
// all filters already loaded :-( // all filters already loaded :-(
@@ -764,7 +764,7 @@ OUString TypeDetection::impl_getTypeFromFilter(const OUString& rFilterName)
CacheItem aFilter; CacheItem aFilter;
try try
{ {
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
aFilter = GetTheFilterCache().getItem(FilterCache::E_FILTER, rFilterName); aFilter = GetTheFilterCache().getItem(FilterCache::E_FILTER, rFilterName);
} }
catch (const container::NoSuchElementException&) catch (const container::NoSuchElementException&)
@@ -786,7 +786,7 @@ void TypeDetection::impl_getAllFormatTypes(
std::vector<OUString> aFilterNames; std::vector<OUString> aFilterNames;
try try
{ {
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
auto & cache = GetTheFilterCache(); auto & cache = GetTheFilterCache();
cache.load(FilterCache::E_CONTAINS_FILTERS); cache.load(FilterCache::E_CONTAINS_FILTERS);
aFilterNames = cache.getItemNames(FilterCache::E_FILTER); aFilterNames = cache.getItemNames(FilterCache::E_FILTER);
@@ -896,7 +896,7 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& r
try try
{ {
// SAFE -> ---------------------------------- // SAFE -> ----------------------------------
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
CacheItem aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sFlatType); CacheItem aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sFlatType);
aLock.clear(); aLock.clear();
@@ -974,7 +974,7 @@ OUString TypeDetection::impl_askDetectService(const OUString& sDet
// SAFE -> // SAFE ->
{ {
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
xContext = m_xContext; xContext = m_xContext;
} }
// <- SAFE // <- SAFE
@@ -1147,7 +1147,7 @@ bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescript
{ {
// SAFE -> // SAFE ->
{ {
osl::MutexGuard aLock(m_aLock); osl::MutexGuard aLock(m_aMutex);
if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType)) if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType))
{ {
rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] <<= sType; rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] <<= sType;
@@ -1168,7 +1168,7 @@ bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescri
try try
{ {
// SAFE -> // SAFE ->
osl::ClearableMutexGuard aLock(m_aLock); osl::ClearableMutexGuard aLock(m_aMutex);
auto & cache = GetTheFilterCache(); auto & cache = GetTheFilterCache();
CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter); CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter);

View File

@@ -27,6 +27,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include <editeng/editengdllapi.h> #include <editeng/editengdllapi.h>
namespace com::sun::star::accessibility { class XAccessibleStateSet; } namespace com::sun::star::accessibility { class XAccessibleStateSet; }
@@ -35,8 +36,6 @@ namespace com::sun::star::accessibility { struct AccessibleEventObject; }
namespace accessibility { namespace accessibility {
struct MutexOwner {mutable ::osl::Mutex maMutex;};
/** @descr /** @descr
This base class provides an implementation of the This base class provides an implementation of the
AccessibleContext service. Apart from the AccessibleContext service. Apart from the
@@ -44,7 +43,7 @@ struct MutexOwner {mutable ::osl::Mutex maMutex;};
interfaces it supports the XServiceInfo interface. interfaces it supports the XServiceInfo interface.
*/ */
class EDITENG_DLLPUBLIC AccessibleContextBase class EDITENG_DLLPUBLIC AccessibleContextBase
: public MutexOwner, : public cppu::BaseMutex,
public cppu::WeakComponentImplHelper< public cppu::WeakComponentImplHelper<
css::accessibility::XAccessible, css::accessibility::XAccessible,
css::accessibility::XAccessibleContext, css::accessibility::XAccessibleContext,

View File

@@ -38,12 +38,6 @@ namespace svt
{ {
struct TMutexInit
{
::osl::Mutex m_aLock;
};
/** /**
@descr implements a helper, which can be used to @descr implements a helper, which can be used to
convert vcl key codes into awt key codes ... convert vcl key codes into awt key codes ...
@@ -67,10 +61,11 @@ struct TMutexInit
Of course this queue will be stopped if the environment Of course this queue will be stopped if the environment
will be destructed... will be destructed...
*/ */
class SVT_DLLPUBLIC AcceleratorExecute final : private TMutexInit class SVT_DLLPUBLIC AcceleratorExecute final
{ {
// member // member
private: private:
::osl::Mutex m_aLock;
/** TODO document me */ /** TODO document me */
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::uno::XComponentContext > m_xContext;

View File

@@ -62,14 +62,6 @@ namespace vcl::unohelper {
); );
}; };
struct MutexHelper
{
private:
::osl::Mutex maMutex;
public:
::osl::Mutex& GetMutex() { return maMutex; }
};
} // namespace vcl::unohelper } // namespace vcl::unohelper
#endif // INCLUDED_VCL_UNOHELP2_HXX #endif // INCLUDED_VCL_UNOHELP2_HXX

View File

@@ -26,20 +26,17 @@
#include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <cppuhelper/component_context.hxx> #include <cppuhelper/component_context.hxx>
#include <cppuhelper/basemutex.hxx>
#include <jvmaccess/virtualmachine.hxx> #include <jvmaccess/virtualmachine.hxx>
#include <jvmaccess/unovirtualmachine.hxx> #include <jvmaccess/unovirtualmachine.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
namespace { namespace {
struct MutexHolder
{
::osl::Mutex m_mutex;
};
typedef ::cppu::WeakComponentImplHelper< typedef ::cppu::WeakComponentImplHelper<
css::lang::XSingleComponentFactory > t_impl; 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; ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > m_vm_access;
@@ -48,7 +45,7 @@ protected:
public: public:
explicit SingletonFactory( ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > const & vm_access ) explicit SingletonFactory( ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > const & vm_access )
: t_impl( m_mutex ), : t_impl( m_aMutex ),
m_vm_access( vm_access ) m_vm_access( vm_access )
{} {}

View File

@@ -240,7 +240,7 @@ Reference<XAccessible> SAL_CALL
{ {
ThrowIfDisposed (); ThrowIfDisposed ();
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
if (mxAccessibleOLEObject.is()) if (mxAccessibleOLEObject.is())
if (nIndex == 0) if (nIndex == 0)
return mxAccessibleOLEObject; return mxAccessibleOLEObject;
@@ -260,7 +260,7 @@ uno::Reference<XAccessible > SAL_CALL
{ {
ThrowIfDisposed (); ThrowIfDisposed ();
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
uno::Reference<XAccessible> xChildAtPosition; uno::Reference<XAccessible> xChildAtPosition;
sal_Int32 nChildCount = getAccessibleChildCount (); sal_Int32 nChildCount = getAccessibleChildCount ();
@@ -604,7 +604,7 @@ void AccessibleDocumentViewBase::SetAccessibleOLEObject (
// Assume that the accessible OLE Object disposes itself correctly. // Assume that the accessible OLE Object disposes itself correctly.
{ {
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
mxAccessibleOLEObject = xOLEObject; mxAccessibleOLEObject = xOLEObject;
} }
@@ -622,7 +622,7 @@ void AccessibleDocumentViewBase::SetAccessibleOLEObject (
::osl::Mutex& ::osl::Mutex&
AccessibleDocumentViewBase::implGetMutex() AccessibleDocumentViewBase::implGetMutex()
{ {
return maMutex; return m_aMutex;
} }
// return ourself as context in default case // return ourself as context in default case
@@ -647,7 +647,7 @@ void
uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
{ {
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
uno::Any anyAttribute; uno::Any anyAttribute;
OUStringBuffer sValue; OUStringBuffer sValue;
@@ -766,7 +766,7 @@ sal_Int32 SAL_CALL AccessibleDocumentViewBase::getForeground( )
sal_Int32 SAL_CALL AccessibleDocumentViewBase::getBackground( ) sal_Int32 SAL_CALL AccessibleDocumentViewBase::getBackground( )
{ {
ThrowIfDisposed (); ThrowIfDisposed ();
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
return sal_Int32(mpViewShell->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor); return sal_Int32(mpViewShell->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
} }
} // end of namespace accessibility } // end of namespace accessibility

View File

@@ -202,7 +202,7 @@ uno::Reference<XAccessible> SAL_CALL
{ {
ThrowIfDisposed (); ThrowIfDisposed ();
::osl::ClearableMutexGuard aGuard (maMutex); ::osl::ClearableMutexGuard aGuard (m_aMutex);
// Take care of children of the base class. // Take care of children of the base class.
sal_Int32 nCount = AccessibleDocumentViewBase::getAccessibleChildCount(); sal_Int32 nCount = AccessibleDocumentViewBase::getAccessibleChildCount();

View File

@@ -151,15 +151,10 @@ public:
On the other side there exists some interactions, which allow a retry. 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. So this helper allow to set a list of interactions combined with a retry value.
*/ */
struct ThreadHelpBase2 class PreventDuplicateInteraction final :
{ public ::cppu::WeakImplHelper<css::lang::XInitialization, css::task::XInteractionHandler2>
public:
mutable ::osl::Mutex m_aLock;
};
class PreventDuplicateInteraction final : private ThreadHelpBase2
, public ::cppu::WeakImplHelper<css::lang::XInitialization, css::task::XInteractionHandler2>
{ {
mutable ::osl::Mutex m_aLock;
// structs, types etc. // structs, types etc.
public: public:

View File

@@ -28,8 +28,7 @@
namespace sfx2 { namespace sfx2 {
PreventDuplicateInteraction::PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext) PreventDuplicateInteraction::PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
: ThreadHelpBase2() : m_xContext(rxContext)
, m_xContext(rxContext)
{ {
} }

View File

@@ -85,7 +85,6 @@ class AsyncAccelExec : public cppu::WeakImplHelper<css::lang::XEventListener>
} }
AcceleratorExecute::AcceleratorExecute() AcceleratorExecute::AcceleratorExecute()
: TMutexInit()
{ {
} }

View File

@@ -142,7 +142,7 @@ typedef ::cppu::WeakImplHelper<
css::accessibility::XAccessibleTableSelection > css::accessibility::XAccessibleTableSelection >
AccessibleTableHeaderShape_BASE; AccessibleTableHeaderShape_BASE;
class AccessibleTableHeaderShape final : public MutexOwner, class AccessibleTableHeaderShape final : public cppu::BaseMutex,
public AccessibleTableHeaderShape_BASE public AccessibleTableHeaderShape_BASE
{ {
public: public:

View File

@@ -357,7 +357,7 @@ IMPLEMENT_GET_IMPLEMENTATION_ID( AccessibleControlShape )
void SAL_CALL AccessibleControlShape::propertyChange( const PropertyChangeEvent& _rEvent ) 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 // check if it is the name or the description
if ( _rEvent.PropertyName == lcl_getNamePropertyName() if ( _rEvent.PropertyName == lcl_getNamePropertyName()
@@ -427,7 +427,7 @@ void SAL_CALL AccessibleControlShape::notifyEvent( const AccessibleEventObject&
AccessibleEventObject aTranslatedEvent( _rEvent ); AccessibleEventObject aTranslatedEvent( _rEvent );
{ {
::osl::MutexGuard aGuard( maMutex ); ::osl::MutexGuard aGuard( m_aMutex );
// let the child manager translate the event // let the child manager translate the event
aTranslatedEvent.Source = *this; aTranslatedEvent.Source = *this;

View File

@@ -359,7 +359,7 @@ uno::Reference<XAccessible> SAL_CALL
uno::Reference<XAccessibleRelationSet> SAL_CALL uno::Reference<XAccessibleRelationSet> SAL_CALL
AccessibleShape::getAccessibleRelationSet() AccessibleShape::getAccessibleRelationSet()
{ {
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
if (mpParent == nullptr) if (mpParent == nullptr)
return uno::Reference<XAccessibleRelationSet>(); return uno::Reference<XAccessibleRelationSet>();
@@ -384,7 +384,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL
uno::Reference<XAccessibleStateSet> SAL_CALL uno::Reference<XAccessibleStateSet> SAL_CALL
AccessibleShape::getAccessibleStateSet() AccessibleShape::getAccessibleStateSet()
{ {
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
if (IsDisposed()) if (IsDisposed())
{ {
@@ -456,7 +456,7 @@ uno::Reference<XAccessible > SAL_CALL
AccessibleShape::getAccessibleAtPoint ( AccessibleShape::getAccessibleAtPoint (
const awt::Point& aPoint) const awt::Point& aPoint)
{ {
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
sal_Int32 nChildCount = getAccessibleChildCount (); sal_Int32 nChildCount = getAccessibleChildCount ();
for (sal_Int32 i=0; i<nChildCount; ++i) for (sal_Int32 i=0; i<nChildCount; ++i)
@@ -487,7 +487,7 @@ uno::Reference<XAccessible > SAL_CALL
awt::Rectangle SAL_CALL AccessibleShape::getBounds() awt::Rectangle SAL_CALL AccessibleShape::getBounds()
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
ThrowIfDisposed (); ThrowIfDisposed ();
awt::Rectangle aBoundingBox; awt::Rectangle aBoundingBox;
@@ -896,7 +896,7 @@ uno::Sequence<uno::Type> SAL_CALL
void AccessibleShape::disposing (const lang::EventObject& aEvent) void AccessibleShape::disposing (const lang::EventObject& aEvent)
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
try try
{ {
@@ -1011,7 +1011,7 @@ OUString AccessibleShape::GetFullAccessibleName (AccessibleShape *shape)
void AccessibleShape::disposing() void AccessibleShape::disposing()
{ {
SolarMutexGuard aSolarGuard; 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 // Make sure to send an event that this object loses the focus in the
// case that it has the focus. // case that it has the focus.

View File

@@ -71,7 +71,7 @@ ChildrenManagerImpl::ChildrenManagerImpl (
AccessibleContextBase& rContext) AccessibleContextBase& rContext)
: ::cppu::WeakComponentImplHelper< : ::cppu::WeakComponentImplHelper<
css::document::XEventListener, css::document::XEventListener,
css::view::XSelectionChangeListener>(maMutex), css::view::XSelectionChangeListener>(m_aMutex),
mxShapeList (rxShapeList), mxShapeList (rxShapeList),
mxParent (rxParent), mxParent (rxParent),
maShapeTreeInfo (rShapeTreeInfo), maShapeTreeInfo (rShapeTreeInfo),

View File

@@ -72,7 +72,7 @@ typedef ::std::vector<ChildDescriptor> ChildDescriptorListType;
@see ChildrenManager @see ChildrenManager
*/ */
class ChildrenManagerImpl final class ChildrenManagerImpl final
: public MutexOwner, : public cppu::BaseMutex,
public cppu::WeakComponentImplHelper< public cppu::WeakComponentImplHelper<
css::document::XEventListener, css::document::XEventListener,
css::view::XSelectionChangeListener>, css::view::XSelectionChangeListener>,

View File

@@ -181,7 +181,7 @@ Reference<XAccessible> SAL_CALL AccessibleCell::getAccessibleChild (sal_Int32 nI
Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet() Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet()
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
Reference<XAccessibleStateSet> xStateSet; Reference<XAccessibleStateSet> xStateSet;
if (rBHelper.bDisposed || mpText == nullptr) 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) Reference<XAccessible > SAL_CALL AccessibleCell::getAccessibleAtPoint ( const css::awt::Point& aPoint)
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
sal_Int32 nChildCount = getAccessibleChildCount (); sal_Int32 nChildCount = getAccessibleChildCount ();
for (sal_Int32 i=0; i<nChildCount; ++i) 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() css::awt::Rectangle SAL_CALL AccessibleCell::getBounds()
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
ThrowIfDisposed (); ThrowIfDisposed ();
css::awt::Rectangle aBoundingBox; css::awt::Rectangle aBoundingBox;
@@ -426,7 +426,7 @@ OUString SAL_CALL AccessibleCell::getToolTipText()
void SAL_CALL AccessibleCell::addAccessibleEventListener( const Reference<XAccessibleEventListener >& rxListener) void SAL_CALL AccessibleCell::addAccessibleEventListener( const Reference<XAccessibleEventListener >& rxListener)
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (maMutex); ::osl::MutexGuard aGuard (m_aMutex);
if (rBHelper.bDisposed || rBHelper.bInDispose) if (rBHelper.bDisposed || rBHelper.bInDispose)
{ {
Reference<XInterface> xSource( static_cast<XComponent *>(this) ); Reference<XInterface> xSource( static_cast<XComponent *>(this) );
@@ -489,7 +489,7 @@ void AccessibleCell::ViewForwarderChanged()
void AccessibleCell::disposing() void AccessibleCell::disposing()
{ {
SolarMutexGuard aSolarGuard; 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 // Make sure to send an event that this object loses the focus in the
// case that it has the focus. // case that it has the focus.

View File

@@ -22,6 +22,7 @@
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/implementationentry.hxx> #include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <ucbhelper/content.hxx> #include <ucbhelper/content.hxx>
@@ -41,16 +42,11 @@ using namespace ::com::sun::star;
namespace namespace
{ {
struct MutexHolder
{
mutable ::osl::Mutex m_mutex;
};
typedef ::cppu::WeakComponentImplHelper< typedef ::cppu::WeakComponentImplHelper<
lang::XServiceInfo, ucb::XContentProvider > t_impl_helper; 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< uno::XComponentContext > m_xComponentContext;
uno::Reference< util::XMacroExpander > m_xMacroExpander; uno::Reference< util::XMacroExpander > m_xMacroExpander;
@@ -64,7 +60,7 @@ protected:
public: public:
explicit ExpandContentProviderImpl( explicit ExpandContentProviderImpl(
uno::Reference< uno::XComponentContext > const & xComponentContext ) uno::Reference< uno::XComponentContext > const & xComponentContext )
: t_impl_helper( m_mutex ), : t_impl_helper( m_aMutex ),
m_xComponentContext( xComponentContext ), m_xComponentContext( xComponentContext ),
m_xMacroExpander( util::theMacroExpander::get(xComponentContext) ) m_xMacroExpander( util::theMacroExpander::get(xComponentContext) )
{} {}

View File

@@ -26,10 +26,9 @@
#include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTargetDropContext.hpp> #include <com/sun/star/datatransfer/dnd/XDropTargetDropContext.hpp>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include <vcl/unohelp2.hxx> class DNDListenerContainer final : public cppu::BaseMutex,
class DNDListenerContainer final : public vcl::unohelper::MutexHelper,
public ::cppu::WeakComponentImplHelper< public ::cppu::WeakComponentImplHelper<
css::datatransfer::dnd::XDragGestureRecognizer, css::datatransfer::dnd::XDragGestureRecognizer,
css::datatransfer::dnd::XDropTargetDragContext, css::datatransfer::dnd::XDropTargetDragContext,

View File

@@ -25,7 +25,7 @@ using namespace ::com::sun::star::datatransfer;
using namespace ::com::sun::star::datatransfer::dnd; using namespace ::com::sun::star::datatransfer::dnd;
DNDListenerContainer::DNDListenerContainer( sal_Int8 nDefaultActions ) DNDListenerContainer::DNDListenerContainer( sal_Int8 nDefaultActions )
: WeakComponentImplHelper< XDragGestureRecognizer, XDropTargetDragContext, XDropTargetDropContext, XDropTarget >(GetMutex()) : WeakComponentImplHelper< XDragGestureRecognizer, XDropTargetDragContext, XDropTargetDropContext, XDropTarget >(m_aMutex)
{ {
m_bActive = true; m_bActive = true;
m_nDefaultActions = nDefaultActions; m_nDefaultActions = nDefaultActions;

View File

@@ -65,11 +65,6 @@ DWORD dndActionsToDropEffects(sal_Int8 actions);
// or Alt). // or Alt).
DWORD dndActionsToSingleDropEffect(sal_Int8 actions); DWORD dndActionsToSingleDropEffect(sal_Int8 actions);
struct MutexDummy
{
osl::Mutex m_mutex;
};
extern css::uno::Reference<css::datatransfer::XTransferable> g_XTransferable; extern css::uno::Reference<css::datatransfer::XTransferable> g_XTransferable;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -51,7 +51,7 @@ using namespace com::sun::star::lang;
static unsigned __stdcall DndOleSTAFunc(LPVOID pParams); static unsigned __stdcall DndOleSTAFunc(LPVOID pParams);
DragSource::DragSource( const Reference<XComponentContext>& rxContext): DragSource::DragSource( const Reference<XComponentContext>& rxContext):
WeakComponentImplHelper< XDragSource, XInitialization, XServiceInfo >(m_mutex), WeakComponentImplHelper< XDragSource, XInitialization, XServiceInfo >(m_aMutex),
m_xContext( rxContext ), m_xContext( rxContext ),
// m_pcurrentContext_impl(0), // m_pcurrentContext_impl(0),
m_hAppWindow(nullptr), m_hAppWindow(nullptr),

View File

@@ -23,6 +23,7 @@
#include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XInitialization.hpp>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include "globals.hxx" #include "globals.hxx"
@@ -43,7 +44,7 @@ class SourceContext;
// RIGHT MOUSE BUTTON drag and drop not supported currently. // RIGHT MOUSE BUTTON drag and drop not supported currently.
// ALT modifier is considered to effect a user selection of effects // ALT modifier is considered to effect a user selection of effects
class DragSource: class DragSource:
public MutexDummy, public cppu::BaseMutex,
public WeakComponentImplHelper<XDragSource, XInitialization, XServiceInfo>, public WeakComponentImplHelper<XDragSource, XInitialization, XServiceInfo>,
public IDropSource public IDropSource

View File

@@ -26,7 +26,7 @@ using namespace com::sun::star::datatransfer::dnd::DNDConstants;
SourceContext::SourceContext( DragSource* pSource, SourceContext::SourceContext( DragSource* pSource,
const Reference<XDragSourceListener>& listener): const Reference<XDragSourceListener>& listener):
WeakComponentImplHelper<XDragSourceContext>(m_mutex), WeakComponentImplHelper<XDragSourceContext>(m_aMutex),
m_pDragSource( pSource), m_pDragSource( pSource),
m_dragSource( static_cast<XDragSource*>( m_pDragSource) ) m_dragSource( static_cast<XDragSource*>( m_pDragSource) )
{ {

View File

@@ -20,6 +20,7 @@
#include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include "source.hxx" #include "source.hxx"
@@ -35,7 +36,7 @@ using namespace ::com::sun::star::lang;
// currently. // currently.
// An instance of SourceContext only lives as long as the drag and drop // An instance of SourceContext only lives as long as the drag and drop
// operation lasts. // operation lasts.
class SourceContext : public MutexDummy, public WeakComponentImplHelper<XDragSourceContext> class SourceContext : public cppu::BaseMutex, public WeakComponentImplHelper<XDragSourceContext>
{ {
DragSource* m_pDragSource; DragSource* m_pDragSource;
Reference<XDragSource> m_dragSource; Reference<XDragSource> m_dragSource;

View File

@@ -47,7 +47,7 @@ using namespace com::sun::star::datatransfer::dnd::DNDConstants;
DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams); DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams);
DropTarget::DropTarget( const Reference<XComponentContext>& rxContext): DropTarget::DropTarget( const Reference<XComponentContext>& rxContext):
WeakComponentImplHelper<XInitialization,XDropTarget, XServiceInfo>(m_mutex), WeakComponentImplHelper<XInitialization,XDropTarget, XServiceInfo>(m_aMutex),
m_hWnd( nullptr), m_hWnd( nullptr),
m_threadIdWindow(0), m_threadIdWindow(0),
m_threadIdTarget(0), m_threadIdTarget(0),
@@ -291,7 +291,7 @@ sal_Bool SAL_CALL DropTarget::isActive( )
void SAL_CALL DropTarget::setActive( sal_Bool _b ) void SAL_CALL DropTarget::setActive( sal_Bool _b )
{ {
MutexGuard g(m_mutex); MutexGuard g(m_aMutex);
m_bActive= _b; m_bActive= _b;
} }

View File

@@ -23,6 +23,7 @@
#include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> #include <com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase.hxx> #include <cppuhelper/compbase.hxx>
#include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/interfacecontainer.hxx>
#include <osl/mutex.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 // If the service calls OleInitialize then it also calls OleUnitialize when
// it is destroyed. Therefore no second instance may exist which was // it is destroyed. Therefore no second instance may exist which was
// created in the same thread and still needs OLE. // created in the same thread and still needs OLE.
class DropTarget : public MutexDummy, class DropTarget : public cppu::BaseMutex,
public WeakComponentImplHelper<XInitialization, XDropTarget, XServiceInfo> public WeakComponentImplHelper<XInitialization, XDropTarget, XServiceInfo>
{ {