[Libreoffice-commits] core.git: accessibility/inc accessibility/source

Arnaud Versini arnaud.versini at gmail.com
Mon Jan 9 18:18:47 UTC 2017


 accessibility/inc/extended/AccessibleBrowseBoxBase.hxx          |    6 
 accessibility/source/extended/AccessibleBrowseBox.cxx           |   14 --
 accessibility/source/extended/AccessibleBrowseBoxBase.cxx       |   18 +-
 accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx  |   60 ++++----
 accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx |    4 
 accessibility/source/extended/AccessibleBrowseBoxTable.cxx      |   39 ++---
 accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx  |   24 +--
 accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx  |   69 ++++------
 accessibility/source/extended/accessiblebrowseboxcell.cxx       |    4 
 accessibility/source/extended/accessibleeditbrowseboxcell.cxx   |   38 ++++-
 accessibility/source/extended/accessibletablistbox.cxx          |    3 
 11 files changed, 135 insertions(+), 144 deletions(-)

New commits:
commit 62affdd4bf8ac45dfe6ce5274623e659895fdafa
Author: Arnaud Versini <arnaud.versini at gmail.com>
Date:   Sun Dec 18 15:18:31 2016 +0100

    accessibility: simplify locking
    
    Change-Id: I87580eabf87fffd86068b5b2e44672aa1f9ffe84
    Reviewed-on: https://gerrit.libreoffice.org/32136
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx b/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx
index 32bc207..dd65a8e 100644
--- a/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx
+++ b/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx
@@ -406,12 +406,10 @@ protected:
 class SolarMethodGuard : public SolarMutexGuard, public osl::MutexGuard
 {
 public:
-    inline SolarMethodGuard( AccessibleBrowseBoxBase& _rOwner, bool _bEnsureAlive = true )
+    inline SolarMethodGuard( osl::Mutex& rMutex )
         :SolarMutexGuard( )
-        ,osl::MutexGuard( _rOwner.getMutex( ) )
+        ,osl::MutexGuard( rMutex )
     {
-        if ( _bEnsureAlive )
-            _rOwner.ensureIsAlive( );
     }
 };
 
diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx
index fea9965..377dc0a 100644
--- a/accessibility/source/extended/AccessibleBrowseBox.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBox.cxx
@@ -112,9 +112,9 @@ void SAL_CALL AccessibleBrowseBox::disposing()
 sal_Int32 SAL_CALL AccessibleBrowseBox::getAccessibleChildCount()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     return BBINDEX_FIRSTCONTROL + mpBrowseBox->GetAccessibleControlCount();
 }
 
@@ -123,8 +123,7 @@ css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
 AccessibleBrowseBox::getAccessibleChild( sal_Int32 nChildIndex )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     css::uno::Reference< css::accessibility::XAccessible > xRet;
@@ -152,8 +151,7 @@ css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
 AccessibleBrowseBox::getAccessibleAtPoint( const awt::Point& rPoint )
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     css::uno::Reference< css::accessibility::XAccessible > xChild;
@@ -183,9 +181,9 @@ AccessibleBrowseBox::getAccessibleAtPoint( const awt::Point& rPoint )
 void SAL_CALL AccessibleBrowseBox::grabFocus()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     mpBrowseBox->GrabFocus();
 }
 
diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
index a13e23f..ccb2c37 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
@@ -187,8 +187,7 @@ Reference< css::accessibility::XAccessibleStateSet > SAL_CALL
 AccessibleBrowseBoxBase::getAccessibleStateSet()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard( getMutex() );
     // don't check whether alive -> StateSet may contain DEFUNC
     return implCreateStateSetHelper();
 }
@@ -404,9 +403,9 @@ void AccessibleBrowseBoxBase::ensureIsAlive() const
 Rectangle AccessibleBrowseBoxBase::getBoundingBox()
     throw ( lang::DisposedException )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     Rectangle aRect = implGetBoundingBox();
     if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
     {
@@ -418,9 +417,9 @@ Rectangle AccessibleBrowseBoxBase::getBoundingBox()
 Rectangle AccessibleBrowseBoxBase::getBoundingBoxOnScreen()
     throw ( lang::DisposedException )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     Rectangle aRect = implGetBoundingBoxOnScreen();
     if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
     {
@@ -494,8 +493,7 @@ void SAL_CALL AccessibleBrowseBoxBase::disposing( const css::lang::EventObject&
 
 sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getForeground(  ) throw (css::uno::RuntimeException, std::exception)
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     sal_Int32 nColor = 0;
@@ -520,9 +518,9 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getForeground(  ) throw (css::uno::R
 
 sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getBackground(  ) throw (css::uno::RuntimeException, std::exception)
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     sal_Int32 nColor = 0;
     vcl::Window* pInst = mpBrowseBox->GetWindowInstance();
     if ( pInst )
diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx
index eb1d0ca..cd9ce96 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx
@@ -56,9 +56,9 @@ Reference< XAccessible > SAL_CALL
 AccessibleBrowseBoxHeaderBar::getAccessibleChild( sal_Int32 nChildIndex )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidHeaderIndex( nChildIndex );
     return implGetChild( nChildIndex, implToVCLColumnPos( nChildIndex ) );
 }
@@ -75,8 +75,7 @@ Reference< XAccessible > SAL_CALL
 AccessibleBrowseBoxHeaderBar::getAccessibleAtPoint( const awt::Point& rPoint )
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     sal_Int32 nRow = 0;
@@ -100,8 +99,8 @@ void SAL_CALL AccessibleBrowseBoxHeaderBar::grabFocus()
 OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleRowDescription( sal_Int32 nRow )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
+
     ensureIsAlive();
     ensureIsValidRow( nRow );
     return OUString();  // no headers in headers
@@ -110,8 +109,8 @@ OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleRowDescription( sal
 OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleColumnDescription( sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
+
     ensureIsAlive();
     ensureIsValidColumn( nColumn );
     return OUString();  // no headers in headers
@@ -134,8 +133,7 @@ Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessib
 Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleRows()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     Sequence< sal_Int32 > aSelSeq;
@@ -148,8 +146,7 @@ Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessib
 Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleColumns()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     Sequence< sal_Int32 > aSelSeq;
@@ -162,8 +159,8 @@ Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessib
 sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleRowSelected( sal_Int32 nRow )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
+
     ensureIsAlive();
     ensureIsValidRow( nRow );
     return isRowBar() && implIsRowSelected( nRow );
@@ -172,8 +169,8 @@ sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleRowSelected( sal_Int
 sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleColumnSelected( sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
+
     ensureIsAlive();
     ensureIsValidColumn( nColumn );
     return isColumnBar() && implIsColumnSelected( nColumn );
@@ -183,10 +180,11 @@ Reference< XAccessible > SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleCel
         sal_Int32 nRow, sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
+
     ensureIsAlive();
     ensureIsValidAddress( nRow, nColumn );
+
     return implGetChild( nRow, implToVCLColumnPos( nColumn ) );
 }
 
@@ -194,9 +192,9 @@ sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleSelected(
         sal_Int32 nRow, sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidAddress( nRow, nColumn );
     return isRowBar() ? implIsRowSelected( nRow ) : implIsColumnSelected( nColumn );
 }
@@ -206,9 +204,9 @@ sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleSelected(
 void SAL_CALL AccessibleBrowseBoxHeaderBar::selectAccessibleChild( sal_Int32 nChildIndex )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidHeaderIndex( nChildIndex );
     if( isRowBar() )
         implSelectRow( nChildIndex, true );
@@ -228,18 +226,18 @@ sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleChildSelected( sal_I
 void SAL_CALL AccessibleBrowseBoxHeaderBar::clearAccessibleSelection()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     mpBrowseBox->SetNoSelection();
 }
 
 void SAL_CALL AccessibleBrowseBoxHeaderBar::selectAllAccessibleChildren()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     // no multiselection of columns possible
     if( isRowBar() )
         mpBrowseBox->SelectAll();
@@ -250,9 +248,9 @@ void SAL_CALL AccessibleBrowseBoxHeaderBar::selectAllAccessibleChildren()
 sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleChildCount()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     return isRowBar() ? implGetSelectedRowCount() : implGetSelectedColumnCount();
 }
 
@@ -260,8 +258,7 @@ Reference< XAccessible > SAL_CALL
 AccessibleBrowseBoxHeaderBar::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     // method may throw lang::IndexOutOfBoundsException
@@ -273,8 +270,7 @@ void SAL_CALL AccessibleBrowseBoxHeaderBar::deselectAccessibleChild(
         sal_Int32 nSelectedChildIndex )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     // method may throw lang::IndexOutOfBoundsException
diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
index af592e2..e9fc495 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
@@ -101,9 +101,9 @@ Reference<XAccessible > SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleChi
 void SAL_CALL AccessibleBrowseBoxHeaderCell::grabFocus()
     throw ( css::uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     if ( isRowBarCell() )
         mpBrowseBox->SelectRow(m_nColumnRowId);
     else
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx
index 2585166..756146d 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx
@@ -51,9 +51,9 @@ Reference< XAccessible > SAL_CALL
 AccessibleBrowseBoxTable::getAccessibleChild( sal_Int32 nChildIndex )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidIndex( nChildIndex );
     return mpBrowseBox->CreateAccessibleCell(
         implGetRow( nChildIndex ), (sal_Int16)implGetColumn( nChildIndex ) );
@@ -72,8 +72,7 @@ Reference< XAccessible > SAL_CALL
 AccessibleBrowseBoxTable::getAccessibleAtPoint( const awt::Point& rPoint )
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     Reference< XAccessible > xChild;
@@ -88,8 +87,7 @@ AccessibleBrowseBoxTable::getAccessibleAtPoint( const awt::Point& rPoint )
 void SAL_CALL AccessibleBrowseBoxTable::grabFocus()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     mpBrowseBox->GrabTableFocus();
 }
@@ -99,8 +97,7 @@ void SAL_CALL AccessibleBrowseBoxTable::grabFocus()
 OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleRowDescription( sal_Int32 nRow )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     ensureIsValidRow( nRow );
     return mpBrowseBox->GetRowDescription( nRow );
@@ -109,9 +106,9 @@ OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleRowDescription( sal_Int
 OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleColumnDescription( sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidColumn( nColumn );
     return mpBrowseBox->GetColumnDescription( (sal_uInt16)nColumn );
 }
@@ -135,8 +132,7 @@ Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxTable::getAccessibleCo
 Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleRows()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     Sequence< sal_Int32 > aSelSeq;
@@ -147,8 +143,7 @@ Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleRo
 Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleColumns()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
     Sequence< sal_Int32 > aSelSeq;
@@ -159,9 +154,9 @@ Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleCo
 sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleRowSelected( sal_Int32 nRow )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidRow( nRow );
     return implIsRowSelected( nRow );
 }
@@ -169,9 +164,9 @@ sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleRowSelected( sal_Int32 n
 sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleColumnSelected( sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidColumn( nColumn );
     return implIsColumnSelected( nColumn );
 }
@@ -180,9 +175,9 @@ Reference< XAccessible > SAL_CALL AccessibleBrowseBoxTable::getAccessibleCellAt(
         sal_Int32 nRow, sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidAddress( nRow, nColumn );
     return mpBrowseBox->CreateAccessibleCell( nRow, (sal_Int16)nColumn );
 }
@@ -191,9 +186,9 @@ sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleSelected(
         sal_Int32 nRow, sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
+
     ensureIsValidAddress( nRow, nColumn );
     return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );
 }
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx
index 1fa4cbe..153ff85 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx
@@ -55,8 +55,7 @@ AccessibleBrowseBoxTableBase::~AccessibleBrowseBoxTableBase()
 sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleChildCount()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     return implGetChildCount();
 }
@@ -73,8 +72,7 @@ sal_Int16 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRole()
 sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRowCount()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     return implGetRowCount();
 }
@@ -82,8 +80,7 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRowCount()
 sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumnCount()
     throw ( uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     return implGetColumnCount();
 }
@@ -92,8 +89,7 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRowExtentAt(
         sal_Int32 nRow, sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     ensureIsValidAddress( nRow, nColumn );
     return 1;   // merged cells not supported
@@ -103,8 +99,7 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumnExtentAt(
         sal_Int32 nRow, sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     ensureIsValidAddress( nRow, nColumn );
     return 1;   // merged cells not supported
@@ -128,8 +123,7 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleIndex(
         sal_Int32 nRow, sal_Int32 nColumn )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     ensureIsValidAddress( nRow, nColumn );
     return nRow * implGetColumnCount() + nColumn;
@@ -138,8 +132,7 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleIndex(
 sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRow( sal_Int32 nChildIndex )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     ensureIsValidIndex( nChildIndex );
     return implGetRow( nChildIndex );
@@ -148,8 +141,7 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRow( sal_Int32 nCh
 sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumn( sal_Int32 nChildIndex )
     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard( getMutex() );
+    SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
     ensureIsValidIndex( nChildIndex );
     return implGetColumn( nChildIndex );
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
index d6d8d1f..ce61700e 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
@@ -119,10 +119,9 @@ namespace accessibility
 
     css::awt::Rectangle SAL_CALL AccessibleBrowseBoxTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
-
+        SolarMethodGuard aGuard(getMutex());
         ensureIsAlive();
+
         if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
             throw IndexOutOfBoundsException();
 
@@ -140,8 +139,7 @@ namespace accessibility
     {
         //! TODO CTL bidi
         // OSL_FAIL("Need to be done by base class!");
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
         ensureIsAlive();
 
         return mpBrowseBox->GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) );
@@ -179,8 +177,7 @@ namespace accessibility
     */
     ::utl::AccessibleStateSetHelper* AccessibleBrowseBoxTableCell::implCreateStateSetHelper()
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
 
         ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper;
 
@@ -213,8 +210,7 @@ namespace accessibility
     sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleIndexInParent()
             throw ( css::uno::RuntimeException, std::exception )
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
         ensureIsAlive();
 
         return /*BBINDEX_FIRSTCONTROL*/ m_nOffset + ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
@@ -224,10 +220,10 @@ namespace accessibility
     {
         return -1;
     }
+
     sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
 
         if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
             throw IndexOutOfBoundsException();
@@ -236,14 +232,13 @@ namespace accessibility
     }
     sal_Unicode SAL_CALL AccessibleBrowseBoxTableCell::getCharacter( sal_Int32 nIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getCharacter( nIndex );
     }
     css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleBrowseBoxTableCell::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
 
         OUString sText( implGetText() );
 
@@ -254,33 +249,33 @@ namespace accessibility
     }
     sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCharacterCount(  ) throw (css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getCharacterCount(  );
     }
 
     OUString SAL_CALL AccessibleBrowseBoxTableCell::getSelectedText(  ) throw (css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getSelectedText(  );
     }
     sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionStart(  ) throw (css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getSelectionStart(  );
     }
     sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionEnd(  ) throw (css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getSelectionEnd(  );
     }
     sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
             throw IndexOutOfBoundsException();
 
@@ -288,38 +283,38 @@ namespace accessibility
     }
     OUString SAL_CALL AccessibleBrowseBoxTableCell::getText(  ) throw (css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getText(  );
     }
     OUString SAL_CALL AccessibleBrowseBoxTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
     }
     css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (css::lang::IndexOutOfBoundsException, css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
     }
     css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (css::lang::IndexOutOfBoundsException, css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
     }
     css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (css::lang::IndexOutOfBoundsException, css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
     }
     sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
+
         OUString sText = implGetText();
         checkIndex_Impl( nStartIndex, sText );
         checkIndex_Impl( nEndIndex, sText );
diff --git a/accessibility/source/extended/accessiblebrowseboxcell.cxx b/accessibility/source/extended/accessiblebrowseboxcell.cxx
index feaa074..576f008 100644
--- a/accessibility/source/extended/accessiblebrowseboxcell.cxx
+++ b/accessibility/source/extended/accessiblebrowseboxcell.cxx
@@ -50,7 +50,9 @@ namespace accessibility
 
     void SAL_CALL AccessibleBrowseBoxCell::grabFocus() throw ( RuntimeException, std::exception )
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         mpBrowseBox->GoToCell( m_nRowPos, m_nColPos );
     }
 
diff --git a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
index d816176..2ce764c 100644
--- a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
+++ b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
@@ -75,7 +75,9 @@ namespace accessibility
     // css::accessibility::XAccessibleComponent
     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getForeground(  ) throw (RuntimeException, std::exception)
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         css::uno::Reference< css::accessibility::XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY );
         if ( xAccComp.is() )
             return xAccComp->getForeground();
@@ -84,7 +86,9 @@ namespace accessibility
 
     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getBackground(  ) throw (RuntimeException, std::exception)
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         css::uno::Reference< css::accessibility::XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY );
         if ( xAccComp.is() )
             return xAccComp->getBackground();
@@ -98,13 +102,16 @@ namespace accessibility
 
     OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleDescription() throw ( RuntimeException, std::exception )
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         return m_xInnerContext->getAccessibleDescription();
     }
 
     OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleName() throw ( RuntimeException, std::exception )
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
 
         return TK_RES_STRING(RID_STR_ACC_COLUMN_NUM).replaceAll("%COLUMNNUMBER", OUString::number(getColumnPos()-1)) + ", "
                + TK_RES_STRING(RID_STR_ACC_ROW_NUM).replaceAll("%ROWNUMBER", OUString::number(getRowPos()));
@@ -112,32 +119,42 @@ namespace accessibility
 
     css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet() throw ( RuntimeException, std::exception )
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         return baseGetAccessibleRelationSet( );
     }
 
     css::uno::Reference<css::accessibility::XAccessibleStateSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleStateSet() throw ( RuntimeException, std::exception )
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         return m_xInnerContext->getAccessibleStateSet();
             // TODO: shouldn't we add an ACTIVE here? Isn't the EditBrowseBoxTableCell always ACTIVE?
     }
 
     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getAccessibleChildCount(  ) throw (RuntimeException, std::exception)
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         return baseGetAccessibleChildCount();
     }
 
     css::uno::Reference< css::accessibility::XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleChild( sal_Int32 i ) throw (css::lang::IndexOutOfBoundsException, RuntimeException, std::exception)
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         return baseGetAccessibleChild( i );
     }
 
     sal_Int16 SAL_CALL EditBrowseBoxTableCell::getAccessibleRole() throw ( RuntimeException, std::exception )
     {
-        SolarMethodGuard aGuard( *this );
+        SolarMethodGuard aGuard(getMutex());
+        ensureIsAlive();
+
         return m_xInnerContext->getAccessibleRole( );
     }
 
@@ -157,7 +174,8 @@ namespace accessibility
 
     void SAL_CALL EditBrowseBoxTableCell::disposing()
     {
-        SolarMethodGuard aGuard( *this, false );
+        SolarMethodGuard aGuard(getMutex());
+
         OAccessibleContextWrapperHelper::dispose();
             // TODO: do we need to dispose our inner object? The base class does this, but is it a good idea?
         AccessibleBrowseBoxCell::disposing();
diff --git a/accessibility/source/extended/accessibletablistbox.cxx b/accessibility/source/extended/accessibletablistbox.cxx
index 4437291..5f7824d 100644
--- a/accessibility/source/extended/accessibletablistbox.cxx
+++ b/accessibility/source/extended/accessibletablistbox.cxx
@@ -91,8 +91,7 @@ namespace accessibility
     AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex )
         throw ( IndexOutOfBoundsException, RuntimeException, std::exception )
     {
-        SolarMutexGuard aSolarGuard;
-        ::osl::MutexGuard aGuard( getMutex() );
+        SolarMethodGuard aGuard(getMutex());
         ensureIsAlive();
 
         if ( nChildIndex < 0 || nChildIndex > 1 )


More information about the Libreoffice-commits mailing list