From 9eccfd86eea1603bdca9f31f3984dcf464406bbc Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 16 Dec 2013 15:35:59 +0100 Subject: accessibility: Mutex cleanup in AccessibleGridControl* classes For unknown reasons this uses both SolarMutex and a OBaseMutex::m_aMutex to lock some but not all methods, which seems odd. - remove a third mutex AccessibleGridControl::m_aMutex that appears unused - lock OBaseMutex::m_aMutex in AccessibleGridControlBase::isAlive() which accesses rBHelper members, which should be sufficient - lock SolarMutex in all UNO methods - remove misc weird stuff like TC_SolarMethodGuard Change-Id: I8321757fb4a5043a05c23f2dc9801f5d8c8d911e --- .../extended/AccessibleGridControl.hxx | 1 - .../extended/AccessibleGridControlBase.hxx | 39 -------------------- .../source/extended/AccessibleGridControl.cxx | 14 ++++---- .../source/extended/AccessibleGridControlBase.cxx | 41 ++++++++++++++-------- .../extended/AccessibleGridControlHeader.cxx | 11 +++--- .../extended/AccessibleGridControlHeaderCell.cxx | 5 ++- .../source/extended/AccessibleGridControlTable.cxx | 38 ++++++++++---------- .../extended/AccessibleGridControlTableBase.cxx | 22 +++++++----- .../extended/AccessibleGridControlTableCell.cxx | 38 +++++++++----------- 9 files changed, 93 insertions(+), 116 deletions(-) (limited to 'accessibility') diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx index e92e4953bd56..c4ed353c28f6 100644 --- a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx @@ -193,7 +193,6 @@ class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base ,public ::svt::table::IAccessibleTableControl { private: - ::osl::Mutex m_aMutex; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; ::svt::table::IAccessibleTable& m_rTable; diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx index 52fdce89540a..fb130c39ea41 100644 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx @@ -286,11 +286,6 @@ protected: void ensureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); - /** @return The ::osl::Mutex member provided by the class OBaseMutex. */ - inline ::osl::Mutex& getOslMutex(); - /** @return Pointer to the global ::osl::Mutex. */ - static inline ::osl::Mutex* getOslGlobalMutex(); - /** Changes the name of the object (flat assignment, no notify). @attention This method requires a locked mutex. */ inline void implSetName( const OUString& rName ); @@ -312,13 +307,6 @@ protected: ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } -public: - // public versions of internal helper methods, with access control - struct TC_AccessControl { friend class TC_SolarMethodGuard; private: TC_AccessControl() { } }; - - inline ::osl::Mutex& getMutex( const TC_AccessControl& ) { return getOslMutex(); } - inline void ensureIsAlive( const TC_AccessControl& ) { ensureIsAlive(); } - protected: // members ---------------------------------------------------------------- @@ -387,23 +375,6 @@ private: GridControlAccessibleElement& operator=( const GridControlAccessibleElement& ); // never implemented }; -// ============================================================================ -// a helper class for protecting methods which need to lock the solar mutex in addition to the own mutex - -typedef ::osl::MutexGuard OslMutexGuard; - -class TC_SolarMethodGuard : public SolarMutexGuard, public OslMutexGuard -{ -public: - inline TC_SolarMethodGuard( AccessibleGridControlBase& _rOwner, bool _bEnsureAlive = true ) - : SolarMutexGuard(), - OslMutexGuard( _rOwner.getMutex( AccessibleGridControlBase::TC_AccessControl() ) ) - { - if ( _bEnsureAlive ) - _rOwner.ensureIsAlive( AccessibleGridControlBase::TC_AccessControl() ); - } -}; - // inlines -------------------------------------------------------------------- inline ::svt::table::AccessibleTableControlObjType AccessibleGridControlBase::getType() const @@ -411,16 +382,6 @@ inline ::svt::table::AccessibleTableControlObjType AccessibleGridControlBase::ge return m_eObjType; } -inline ::osl::Mutex& AccessibleGridControlBase::getOslMutex() -{ - return m_aMutex; -} - -inline ::osl::Mutex* AccessibleGridControlBase::getOslGlobalMutex() -{ - return ::osl::Mutex::getGlobalMutex(); -} - inline void AccessibleGridControlBase::implSetName( const OUString& rName ) { diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index df7b8a0a7c65..8ce58001b046 100644 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -87,7 +87,7 @@ AccessibleGridControl::~AccessibleGridControl() void SAL_CALL AccessibleGridControl::disposing() { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; m_pImpl->m_pTable = NULL; m_pImpl->m_pColumnHeaderBar = NULL; @@ -122,7 +122,6 @@ sal_Int32 SAL_CALL AccessibleGridControl::getAccessibleChildCount() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); return m_aTable.GetAccessibleControlCount(); } @@ -133,7 +132,6 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount()) throw IndexOutOfBoundsException(); @@ -177,6 +175,8 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) sal_Int16 SAL_CALL AccessibleGridControl::getAccessibleRole() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return AccessibleRole::PANEL; } @@ -189,7 +189,6 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); Reference< XAccessible > xChild; @@ -220,7 +219,6 @@ void SAL_CALL AccessibleGridControl::grabFocus() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); m_aTable.GrabFocus(); } @@ -229,6 +227,8 @@ void SAL_CALL AccessibleGridControl::grabFocus() Any SAL_CALL AccessibleGridControl::getAccessibleKeyBinding() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return Any(); } @@ -422,7 +422,7 @@ AccessibleGridControlAccess::~AccessibleGridControlAccess() // ----------------------------------------------------------------------------- void AccessibleGridControlAccess::dispose() { - ::osl::MutexGuard aGuard( m_aMutex ); + SolarMutexGuard g; m_pContext = NULL; ::comphelper::disposeComponent( m_xContext ); @@ -431,7 +431,7 @@ void AccessibleGridControlAccess::dispose() // ----------------------------------------------------------------------------- Reference< XAccessibleContext > SAL_CALL AccessibleGridControlAccess::getAccessibleContext() throw ( RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); + SolarMutexGuard g; OSL_ENSURE( ( m_pContext && m_xContext.is() ) || ( !m_pContext && !m_xContext.is() ), "accessibility/extended/AccessibleGridControlAccess::getAccessibleContext: inconsistency!" ); diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx index 553ccbb19362..8df5cf657956 100644 --- a/accessibility/source/extended/AccessibleGridControlBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlBase.cxx @@ -72,7 +72,7 @@ AccessibleGridControlBase::~AccessibleGridControlBase() void SAL_CALL AccessibleGridControlBase::disposing() { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; if ( getClientId( ) ) { @@ -90,7 +90,8 @@ void SAL_CALL AccessibleGridControlBase::disposing() Reference< XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleParent() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + ensureIsAlive(); return m_xParent; } @@ -98,7 +99,8 @@ Reference< XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleParent sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + ensureIsAlive(); // -1 for child not found/no parent (according to specification) @@ -133,7 +135,8 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent() OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + ensureIsAlive(); return m_aDescription; } @@ -141,7 +144,8 @@ OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription() OUString SAL_CALL AccessibleGridControlBase::getAccessibleName() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + ensureIsAlive(); return m_aName; } @@ -150,6 +154,8 @@ Reference< XAccessibleRelationSet > SAL_CALL AccessibleGridControlBase::getAccessibleRelationSet() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); // GridControl does not have relations. return new utl::AccessibleRelationSetHelper; @@ -160,7 +166,7 @@ AccessibleGridControlBase::getAccessibleStateSet() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + // don't check whether alive -> StateSet may contain DEFUNC return implCreateStateSetHelper(); } @@ -168,7 +174,8 @@ AccessibleGridControlBase::getAccessibleStateSet() lang::Locale SAL_CALL AccessibleGridControlBase::getLocale() throw ( IllegalAccessibleComponentStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + ensureIsAlive(); if( m_xParent.is() ) { @@ -216,7 +223,7 @@ sal_Bool SAL_CALL AccessibleGridControlBase::isShowing() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); return implIsShowing(); } @@ -244,7 +251,8 @@ void SAL_CALL AccessibleGridControlBase::addAccessibleEventListener( { if ( _rxListener.is() ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + if ( !getClientId( ) ) setClientId( AccessibleEventNotifier::registerClient( ) ); @@ -258,7 +266,8 @@ void SAL_CALL AccessibleGridControlBase::removeAccessibleEventListener( { if( _rxListener.is() && getClientId( ) ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener ); if ( !nListenerCount ) { @@ -339,6 +348,7 @@ sal_Bool AccessibleGridControlBase::implIsShowing() sal_Bool AccessibleGridControlBase::isAlive() const { + ::osl::MutexGuard g(m_aMutex); // guards rBHelper members return !rBHelper.bDisposed && !rBHelper.bInDispose && &m_aTable; } @@ -353,7 +363,6 @@ Rectangle AccessibleGridControlBase::getBoundingBox() throw ( lang::DisposedException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); Rectangle aRect = implGetBoundingBox(); if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() ) @@ -367,7 +376,6 @@ Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen() throw ( lang::DisposedException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); Rectangle aRect = implGetBoundingBoxOnScreen(); if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() ) @@ -380,7 +388,8 @@ Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen() void AccessibleGridControlBase::commitEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) { - ::osl::ClearableMutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + if ( !getClientId( ) ) // if we don't have a client id for the notifier, then we don't have listeners, then // we don't need to notify anything @@ -441,7 +450,7 @@ Reference SAL_CALL AccessibleGridControlBase::getAccessibleAtPoint sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); sal_Int32 nColor = 0; @@ -466,7 +475,7 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) throw (::com::su sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); sal_Int32 nColor = 0; Window* pInst = m_aTable.GetWindowInstance(); @@ -498,6 +507,8 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridControlAccessibleElement, AccessibleGridCo Reference< XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return this; } diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx index 0bc164962a6c..24f3116f1371 100644 --- a/accessibility/source/extended/AccessibleGridControlHeader.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx @@ -64,7 +64,6 @@ AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount()) throw IndexOutOfBoundsException(); @@ -100,7 +99,7 @@ AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint ) throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); sal_Int32 nRow = 0; @@ -132,7 +131,7 @@ OUString SAL_CALL AccessibleGridControlHeader::getAccessibleRowDescription( sal_ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidRow( nRow ); return OUString(); // no headers in headers @@ -142,7 +141,7 @@ OUString SAL_CALL AccessibleGridControlHeader::getAccessibleColumnDescription( s throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidColumn( nColumn ); return OUString(); // no headers in headers @@ -151,6 +150,8 @@ OUString SAL_CALL AccessibleGridControlHeader::getAccessibleColumnDescription( s Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleRowHeaders() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return NULL; // no headers in headers } @@ -158,6 +159,8 @@ Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibl Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleColumnHeaders() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return NULL; // no headers in headers } diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx index 548c21b05e5b..f716a8aade25 100644 --- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx @@ -45,7 +45,6 @@ AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nCol */ ::utl::AccessibleStateSetHelper* AccessibleGridControlHeaderCell::implCreateStateSetHelper() { - ::osl::MutexGuard aGuard( getOslMutex() ); ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper; @@ -55,7 +54,6 @@ AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nCol if( implIsShowing() ) pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - SolarMutexGuard aSolarGuard; pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); @@ -163,7 +161,8 @@ Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen() sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent() throw ( RuntimeException ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + ensureIsAlive(); sal_Int32 nIndex = m_nColumnRowId; return nIndex; diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx index 3b08eadfd62f..5b3174047dc5 100644 --- a/accessibility/source/extended/AccessibleGridControlTable.cxx +++ b/accessibility/source/extended/AccessibleGridControlTable.cxx @@ -58,7 +58,7 @@ AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex ) throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidIndex( nChildIndex ); sal_Int32 nCount = getAccessibleChildCount(); @@ -95,7 +95,7 @@ AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint ) throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); Reference< XAccessible > xChild; @@ -110,7 +110,7 @@ void SAL_CALL AccessibleGridControlTable::grabFocus() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); m_aTable.GrabFocus(); } @@ -128,7 +128,7 @@ OUString SAL_CALL AccessibleGridControlTable::getAccessibleRowDescription( sal_I throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidRow( nRow ); return m_aTable.GetRowDescription( nRow ); @@ -138,7 +138,7 @@ OUString SAL_CALL AccessibleGridControlTable::getAccessibleColumnDescription( sa throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidColumn( nColumn ); return m_aTable.GetColumnDescription( (sal_uInt16)nColumn ); @@ -147,7 +147,8 @@ OUString SAL_CALL AccessibleGridControlTable::getAccessibleColumnDescription( sa Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleRowHeaders() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + ensureIsAlive(); if(m_aTable.HasColHeader()) return implGetHeaderBar( 1 ); @@ -158,7 +159,8 @@ Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessible Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleColumnHeaders() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( getOslMutex() ); + SolarMutexGuard g; + ensureIsAlive(); return implGetHeaderBar( 0 ); } @@ -167,7 +169,7 @@ Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessible throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); Sequence< sal_Int32 > aSelSeq; implGetSelectedRows( aSelSeq ); @@ -186,7 +188,7 @@ sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidRow( nRow ); sal_Bool bSelected = sal_False; @@ -215,7 +217,7 @@ Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellA throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidAddress( nRow, nColumn ); sal_Int32 nCount = getAccessibleChildCount(); @@ -239,7 +241,7 @@ sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected( throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidAddress( nRow, nColumn ); (void) nColumn; @@ -250,7 +252,7 @@ void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChil throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidIndex( nChildIndex ); sal_Int32 nColumns = m_aTable.GetColumnCount(); @@ -261,7 +263,7 @@ sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidIndex( nChildIndex ); sal_Int32 nColumns = m_aTable.GetColumnCount(); @@ -272,7 +274,7 @@ void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); m_aTable.SelectAllRows( false ); } @@ -280,7 +282,7 @@ void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); for(int i=0;i selectedRows = getSelectedAccessibleRows(); sal_Int32 nColumns = m_aTable.GetColumnCount(); @@ -301,7 +303,7 @@ AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChild throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); if(isAccessibleChildSelected(nSelectedChildIndex)) return getAccessibleChild(nSelectedChildIndex); @@ -314,7 +316,7 @@ void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild( throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); (void)nSelectedChildIndex; } diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx index f6d75707dade..737a59ea6a43 100644 --- a/accessibility/source/extended/AccessibleGridControlTableBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx @@ -58,7 +58,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleChildCount() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); sal_Int32 nChildren = 0; if(m_eObjType == TCTYPE_ROWHEADERBAR) @@ -73,6 +73,8 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleChildCount() sal_Int16 SAL_CALL AccessibleGridControlTableBase::getAccessibleRole() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return AccessibleRole::TABLE; } @@ -83,7 +85,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowCount() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); return m_aTable.GetRowCount(); } @@ -92,7 +94,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnCount() throw ( uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); return m_aTable.GetColumnCount(); } @@ -102,7 +104,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowExtentAt( throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidAddress( nRow, nColumn ); return 1; // merged cells not supported @@ -113,7 +115,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnExtentAt( throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidAddress( nRow, nColumn ); return 1; // merged cells not supported @@ -122,6 +124,8 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnExtentAt( Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleCaption() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return NULL; // not supported } @@ -129,6 +133,8 @@ Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleC Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleSummary() throw ( uno::RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return NULL; // not supported } @@ -138,7 +144,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleIndex( throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidAddress( nRow, nColumn ); return implGetChildIndex( nRow, nColumn ); @@ -148,7 +154,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRow( sal_Int32 n throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidIndex( nChildIndex ); return implGetRow( nChildIndex ); @@ -158,7 +164,7 @@ sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumn( sal_Int3 throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); ensureIsValidIndex( nChildIndex ); return implGetColumn( nChildIndex ); diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx index 1f700880b1f0..84fdb1aaf146 100644 --- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx @@ -80,7 +80,7 @@ namespace accessibility void SAL_CALL AccessibleGridControlCell::grabFocus() throw ( RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + m_aTable.GoToCell( m_nColPos, m_nRowPos ); } //// ----------------------------------------------------------------------------- @@ -140,7 +140,6 @@ namespace accessibility ::com::sun::star::awt::Rectangle SAL_CALL AccessibleGridControlTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); ensureIsAlive(); if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) @@ -156,7 +155,7 @@ namespace accessibility sal_Int32 SAL_CALL AccessibleGridControlTableCell::getIndexAtPoint( const ::com::sun::star::awt::Point& _aPoint ) throw (RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); return m_aTable.GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) ); @@ -195,9 +194,6 @@ namespace accessibility */ ::utl::AccessibleStateSetHelper* AccessibleGridControlTableCell::implCreateStateSetHelper() { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper; if( isAlive() ) @@ -220,6 +216,8 @@ namespace accessibility /** @return The XAccessibleContext interface of this object. */ Reference< XAccessibleContext > SAL_CALL AccessibleGridControlTableCell::getAccessibleContext() throw ( RuntimeException ) { + SolarMutexGuard g; + ensureIsAlive(); return this; } @@ -230,7 +228,7 @@ namespace accessibility throw ( ::com::sun::star::uno::RuntimeException ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); return ( getRowPos() * m_aTable.GetColumnCount() ) + getColumnPos(); @@ -243,7 +241,6 @@ namespace accessibility sal_Bool SAL_CALL AccessibleGridControlTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) throw IndexOutOfBoundsException(); @@ -253,13 +250,12 @@ namespace accessibility sal_Unicode SAL_CALL AccessibleGridControlTableCell::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getCharacter( nIndex ); } ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleGridControlTableCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); OUString sText( implGetText() ); @@ -271,32 +267,32 @@ namespace accessibility sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getCharacterCount( ); } OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getSelectedText( ); } sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getSelectionStart( ); } sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getSelectionEnd( ); } sal_Bool SAL_CALL AccessibleGridControlTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) throw IndexOutOfBoundsException(); @@ -305,37 +301,37 @@ namespace accessibility OUString SAL_CALL AccessibleGridControlTableCell::getText( ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getText( ); } OUString SAL_CALL AccessibleGridControlTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); } ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); } ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); } ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); } sal_Bool SAL_CALL AccessibleGridControlTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); + OUString sText = implGetText(); checkIndex_Impl( nStartIndex, sText ); checkIndex_Impl( nEndIndex, sText ); -- cgit