summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/accessiblecomponenthelper.hxx8
-rw-r--r--include/comphelper/accessiblecontexthelper.hxx80
-rw-r--r--include/comphelper/accessibleselectionhelper.hxx3
-rw-r--r--include/comphelper/accessibletexthelper.hxx3
-rw-r--r--include/toolkit/awt/vclxaccessiblecomponent.hxx4
-rw-r--r--include/toolkit/controls/accessiblecontrolcontext.hxx4
-rw-r--r--include/toolkit/helper/externallock.hxx44
7 files changed, 11 insertions, 135 deletions
diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx
index 42a886a0a5a3..e7ac2fa157a6 100644
--- a/include/comphelper/accessiblecomponenthelper.hxx
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -41,7 +41,7 @@ namespace comphelper
{
protected:
/// see the respective base class ctor for an extensive comment on this, please
- OCommonAccessibleComponent( IMutex* _pExternalLock );
+ OCommonAccessibleComponent();
virtual ~OCommonAccessibleComponent() override;
protected:
@@ -87,8 +87,7 @@ namespace comphelper
,public OAccessibleComponentHelper_Base
{
protected:
- /// see the respective base class ctor for an extensive comment on this, please
- OAccessibleComponentHelper( IMutex* _pExternalLock );
+ OAccessibleComponentHelper();
public:
// XInterface
@@ -118,8 +117,7 @@ namespace comphelper
,public OAccessibleExtendedComponentHelper_Base
{
protected:
- /// see the respective base class ctor for an extensive comment on this, please
- OAccessibleExtendedComponentHelper( IMutex* _pExternalLock );
+ OAccessibleExtendedComponentHelper( );
public:
// XInterface
diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx
index 7163817280a3..1cc27da80b3e 100644
--- a/include/comphelper/accessiblecontexthelper.hxx
+++ b/include/comphelper/accessiblecontexthelper.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/comphelperdllapi.h>
+#include <comphelper/solarmutex.hxx>
#include <memory>
@@ -33,45 +34,6 @@ namespace comphelper
{
- //= IMutex
-
-
- // This whole thingie here (own mutex classes and such) is a HACK. I hate the SolarMutex.
- // See below for more explanations ....
-
- /** abstract interface for implementing a mutex
- */
- class COMPHELPER_DLLPUBLIC IMutex
- {
- public:
- virtual ~IMutex();
- virtual void acquire() = 0;
- virtual void release() = 0;
- };
-
-
- //= OMutexGuard
-
-
- class OMutexGuard
- {
- IMutex* m_pMutex;
- public:
- OMutexGuard( IMutex* _pMutex )
- :m_pMutex( _pMutex )
- {
- if ( m_pMutex )
- m_pMutex->acquire();
- }
-
- ~OMutexGuard( )
- {
- if ( m_pMutex )
- m_pMutex->release();
- }
- };
-
-
//= OAccessibleContextHelper
@@ -92,33 +54,7 @@ namespace comphelper
protected:
virtual ~OAccessibleContextHelper( ) override;
- /** ctor
-
- <p>If you need additional object safety for your class, and want to ensure that your own
- mutex is locked before the mutex this class provides is, than use this ctor.</p>
-
- <p>Beware that this is a hack. Unfortunately, OpenOffice.org has two different mutex hierarchies,
- which are not compatible. In addition, wide parts of the code (especially VCL) is not thread-safe,
- but instead relies on a <em>single global mutex</em>. As a consequence, components using
- directly or indirectly such code need to care for this global mutex. Yes, this is as ugly as
- anything.</p>
-
- <p>Note that the external lock is used as additional lock, not as the only one. The own mutex of the
- instance is used for internal actions, and every action which potentially involves external code
- (for instance every call to a virtual method overridden by derivees) is <em>additionally</em> and
- <em>first</em> guarded by with the external lock.</p>
-
- <p>Beware of the lifetime of the lock - you must ensure that the lock exists at least as long as
- the context does. A good approach to implement the lock may be to derive you own context
- not only from OAccessibleContextHelper, but also from IMutex.</p>
-
- <p>One more note. This lock is definitely not used once the dtor is reached. Means whatever
- the dtor implementation does, it does <em>not</em> guard the external lock. See this as a contract.
- <br/>You should ensure the same thing for own derivees which do not supply the lock themself,
- but get them from yet another derivee.</p>
- @see forgetExternalLock
- */
- OAccessibleContextHelper( IMutex* _pExternalLock );
+ OAccessibleContextHelper( );
/** late construction
@param _rxAccessible
@@ -180,7 +116,6 @@ namespace comphelper
// ensures that the object is alive
inline void ensureAlive( const OAccessControl& ) const;
- inline IMutex* getExternalLock( const OAccessControl& );
inline ::osl::Mutex& GetMutex( const OAccessControl& );
protected:
@@ -224,7 +159,6 @@ namespace comphelper
// access to the base class' broadcast helper/mutex
::osl::Mutex& GetMutex() { return m_aMutex; }
- IMutex* getExternalLock( );
};
@@ -234,12 +168,6 @@ namespace comphelper
}
- inline IMutex* OAccessibleContextHelper::getExternalLock( const OAccessControl& )
- {
- return getExternalLock();
- }
-
-
inline ::osl::Mutex& OAccessibleContextHelper::GetMutex( const OAccessControl& )
{
return GetMutex();
@@ -287,7 +215,7 @@ namespace comphelper
//= OExternalLockGuard
class OExternalLockGuard
- :public OMutexGuard
+ :public osl::Guard<SolarMutex>
,public OContextEntryGuard
{
public:
@@ -296,7 +224,7 @@ namespace comphelper
inline OExternalLockGuard::OExternalLockGuard( OAccessibleContextHelper* _pContext )
- :OMutexGuard( _pContext->getExternalLock( OAccessibleContextHelper::OAccessControl() ) )
+ :osl::Guard<SolarMutex>( SolarMutex::get() )
,OContextEntryGuard( _pContext )
{
// Only lock the external mutex,
diff --git a/include/comphelper/accessibleselectionhelper.hxx b/include/comphelper/accessibleselectionhelper.hxx
index 0a67e48f498b..d96347f51bb8 100644
--- a/include/comphelper/accessibleselectionhelper.hxx
+++ b/include/comphelper/accessibleselectionhelper.hxx
@@ -104,8 +104,7 @@ namespace comphelper
{
protected:
- /// see the respective base class ctor for an extensive comment on this, please
- OAccessibleSelectionHelper( IMutex* _pExternalLock );
+ OAccessibleSelectionHelper();
// return ourself here by default
virtual css::uno::Reference< css::accessibility::XAccessibleContext > implGetAccessibleContext() override;
diff --git a/include/comphelper/accessibletexthelper.hxx b/include/comphelper/accessibletexthelper.hxx
index 8083ba6ed211..7b5e1a144eac 100644
--- a/include/comphelper/accessibletexthelper.hxx
+++ b/include/comphelper/accessibletexthelper.hxx
@@ -128,8 +128,7 @@ namespace comphelper
public OAccessibleTextHelper_Base
{
protected:
- // see the respective base class ctor for an extensive comment on this, please
- OAccessibleTextHelper( IMutex* _pExternalLock );
+ OAccessibleTextHelper();
public:
// XInterface
diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx
index e29520198bef..f37c95c1d593 100644
--- a/include/toolkit/awt/vclxaccessiblecomponent.hxx
+++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx
@@ -30,7 +30,6 @@
#include <cppuhelper/implbase1.hxx>
#include <comphelper/accimplaccess.hxx>
#include <comphelper/accessiblecomponenthelper.hxx>
-#include <toolkit/helper/externallock.hxx>
#include <tools/link.hxx>
@@ -53,8 +52,7 @@ typedef ::cppu::ImplHelper1<
css::lang::XServiceInfo > VCLXAccessibleComponent_BASE;
class TOOLKIT_DLLPUBLIC VCLXAccessibleComponent
- :private BaseVCLExternalSolarLock
- ,public comphelper::OAccessibleExtendedComponentHelper
+ :public comphelper::OAccessibleExtendedComponentHelper
,public ::comphelper::OAccessibleImplementationAccess
,public VCLXAccessibleComponent_BASE
{
diff --git a/include/toolkit/controls/accessiblecontrolcontext.hxx b/include/toolkit/controls/accessiblecontrolcontext.hxx
index 7642433642ee..cbd304a1334d 100644
--- a/include/toolkit/controls/accessiblecontrolcontext.hxx
+++ b/include/toolkit/controls/accessiblecontrolcontext.hxx
@@ -27,7 +27,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <vcl/vclptr.hxx>
-#include <toolkit/helper/externallock.hxx>
namespace vcl { class Window; }
@@ -49,8 +48,7 @@ namespace toolkit
is being disposed.</p>
*/
class OAccessibleControlContext
- :private BaseVCLExternalSolarLock
- ,public ::comphelper::OAccessibleImplementationAccess
+ :public ::comphelper::OAccessibleImplementationAccess
,public OAccessibleControlContext_Base
,public OAccessibleControlContext_IBase
{
diff --git a/include/toolkit/helper/externallock.hxx b/include/toolkit/helper/externallock.hxx
deleted file mode 100644
index ddac625e73bf..000000000000
--- a/include/toolkit/helper/externallock.hxx
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_TOOLKIT_HELPER_EXTERNALLOCK_HXX
-#define INCLUDED_TOOLKIT_HELPER_EXTERNALLOCK_HXX
-
-#include <toolkit/dllapi.h>
-#include <comphelper/accessiblecontexthelper.hxx>
-
-
-// class VCLExternalSolarLock
-
-
-class TOOLKIT_DLLPUBLIC VCLExternalSolarLock : public ::comphelper::IMutex
-{
-public:
- virtual void acquire() override;
- virtual void release() override;
-};
-
-class BaseVCLExternalSolarLock
-{
-protected:
- mutable VCLExternalSolarLock m_aLock;
-};
-
-#endif // INCLUDED_TOOLKIT_HELPER_EXTERNALLOCK_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */