From da21e9de6a71dcd1926f5bf167049bce0590515e Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 3 Oct 2013 14:57:12 +0200 Subject: [PATCH] require OAccessibleContextHelper to be initialized with SolarMutex OAccessibleContextHelper methods are locked by OExternalLockGuard which effectively only locks its ExternalMutex (i.e. SolarMutex); so ensure that all sub-classes actually pass in a SolarMutex by removing the default constructor. (since these classes are in comphelper they can only use the SolarMutex indirectly) This uncovers that AccessibleToolPanelDeckTabBarItem and OAccessibleControlContext did not pass in SolarMutex before. Change-Id: Ib9085eeee6225f7c74b158e72f04b1bf62622071 --- .../AccessibleToolPanelDeckTabBarItem.cxx | 6 +++++- .../source/misc/accessiblecomponenthelper.cxx | 18 ------------------ .../source/misc/accessiblecontexthelper.cxx | 9 +-------- .../comphelper/accessiblecomponenthelper.hxx | 3 --- include/comphelper/accessiblecontexthelper.hxx | 2 +- .../controls/accessiblecontrolcontext.cxx | 3 ++- 6 files changed, 9 insertions(+), 32 deletions(-) diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx index 86c8680effe3..8b7a2fdb0bdf 100644 --- a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx +++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -263,7 +264,10 @@ namespace accessibility //------------------------------------------------------------------------------------------------------------------ AccessibleToolPanelDeckTabBarItem::AccessibleToolPanelDeckTabBarItem( const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, const size_t i_nItemPos ) - :m_pImpl( new AccessibleToolPanelDeckTabBarItem_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos ) ) + : ::comphelper::OAccessibleExtendedComponentHelper( + new VCLExternalSolarLock) + , m_pImpl(new AccessibleToolPanelDeckTabBarItem_Impl(*this, + i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos)) { } diff --git a/comphelper/source/misc/accessiblecomponenthelper.cxx b/comphelper/source/misc/accessiblecomponenthelper.cxx index 0a7c08c8c59d..816b24b30f3f 100644 --- a/comphelper/source/misc/accessiblecomponenthelper.cxx +++ b/comphelper/source/misc/accessiblecomponenthelper.cxx @@ -32,11 +32,6 @@ namespace comphelper //===================================================================== //= OCommonAccessibleComponent //===================================================================== - //--------------------------------------------------------------------- - OCommonAccessibleComponent::OCommonAccessibleComponent( ) - { - } - //--------------------------------------------------------------------- OCommonAccessibleComponent::OCommonAccessibleComponent( IMutex* _pExternalLock ) :OAccessibleContextHelper( _pExternalLock ) @@ -46,9 +41,6 @@ namespace comphelper //--------------------------------------------------------------------- OCommonAccessibleComponent::~OCommonAccessibleComponent( ) { - forgetExternalLock(); - // this ensures that the lock, which may be already destroyed as part of the derivee, - // is not used anymore } //-------------------------------------------------------------------- @@ -108,11 +100,6 @@ namespace comphelper //===================================================================== //= OAccessibleComponentHelper //===================================================================== - //--------------------------------------------------------------------- - OAccessibleComponentHelper::OAccessibleComponentHelper( ) - { - } - //--------------------------------------------------------------------- OAccessibleComponentHelper::OAccessibleComponentHelper( IMutex* _pExternalLock ) :OCommonAccessibleComponent( _pExternalLock ) @@ -157,11 +144,6 @@ namespace comphelper //===================================================================== //= OAccessibleExtendedComponentHelper //===================================================================== - //--------------------------------------------------------------------- - OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( ) - { - } - //--------------------------------------------------------------------- OAccessibleExtendedComponentHelper::OAccessibleExtendedComponentHelper( IMutex* _pExternalLock ) :OCommonAccessibleComponent( _pExternalLock ) diff --git a/comphelper/source/misc/accessiblecontexthelper.cxx b/comphelper/source/misc/accessiblecontexthelper.cxx index bb9047d5ca82..3b7836377698 100644 --- a/comphelper/source/misc/accessiblecontexthelper.cxx +++ b/comphelper/source/misc/accessiblecontexthelper.cxx @@ -78,19 +78,12 @@ namespace comphelper //===================================================================== //= OAccessibleContextHelper //===================================================================== - //--------------------------------------------------------------------- - OAccessibleContextHelper::OAccessibleContextHelper( ) - :OAccessibleContextHelper_Base( GetMutex() ) - ,m_pImpl( NULL ) - { - m_pImpl = new OContextHelper_Impl(); - } - //--------------------------------------------------------------------- OAccessibleContextHelper::OAccessibleContextHelper( IMutex* _pExternalLock ) :OAccessibleContextHelper_Base( GetMutex() ) ,m_pImpl( NULL ) { + assert(_pExternalLock); m_pImpl = new OContextHelper_Impl(); m_pImpl->setExternalLock( _pExternalLock ); } diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx index d0eabc27b807..dc31550e8e5b 100644 --- a/include/comphelper/accessiblecomponenthelper.hxx +++ b/include/comphelper/accessiblecomponenthelper.hxx @@ -41,7 +41,6 @@ namespace comphelper class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent : public OAccessibleContextHelper { protected: - OCommonAccessibleComponent(); /// see the respective base class ctor for an extensive comment on this, please OCommonAccessibleComponent( IMutex* _pExternalLock ); ~OCommonAccessibleComponent(); @@ -81,7 +80,6 @@ namespace comphelper ,public OAccessibleComponentHelper_Base { protected: - OAccessibleComponentHelper( ); /// see the respective base class ctor for an extensive comment on this, please OAccessibleComponentHelper( IMutex* _pExternalLock ); @@ -113,7 +111,6 @@ namespace comphelper ,public OAccessibleExtendedComponentHelper_Base { protected: - OAccessibleExtendedComponentHelper( ); /// see the respective base class ctor for an extensive comment on this, please OAccessibleExtendedComponentHelper( IMutex* _pExternalLock ); diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx index e6c5c10ab20f..f01c9117c400 100644 --- a/include/comphelper/accessiblecontexthelper.hxx +++ b/include/comphelper/accessiblecontexthelper.hxx @@ -90,7 +90,6 @@ namespace comphelper OContextHelper_Impl* m_pImpl; protected: - OAccessibleContextHelper( ); ~OAccessibleContextHelper( ); /** ctor @@ -141,6 +140,7 @@ namespace comphelper ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleCreator( ) const; + private: /** forgets the reference to the external lock, if present.

This means any further locking will not be guard the external lock anymore, never.

diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx index 7be5732e1799..509d2ba78f27 100644 --- a/toolkit/source/controls/accessiblecontrolcontext.cxx +++ b/toolkit/source/controls/accessiblecontrolcontext.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include //........................................................................ @@ -44,7 +45,7 @@ namespace toolkit //==================================================================== //-------------------------------------------------------------------- OAccessibleControlContext::OAccessibleControlContext() - :OAccessibleControlContext_Base( ) + : OAccessibleControlContext_Base(new VCLExternalSolarLock) { // nothing to do here, we have a late ctor }