[Libreoffice-commits] core.git: 3 commits - editeng/source svx/source sw/source

Michael Stahl mstahl at redhat.com
Fri Dec 16 09:25:30 UTC 2016


 editeng/source/accessibility/AccessibleContextBase.cxx |    6 --
 svx/source/accessibility/AccessibleShape.cxx           |   38 +++--------------
 sw/source/core/view/viewimp.cxx                        |   12 ++++-
 3 files changed, 18 insertions(+), 38 deletions(-)

New commits:
commit 9ada2da6f1bceb5d24f23d8df08103535714918a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 15 23:08:53 2016 +0100

    tdf#104488 sw: assert if exception escapes from UpdateAccessible()
    
    SwViewShellImp::UpdateAccessible() is called during scrolling and the
    like, and if the a11y code doesn't catch the exceptions the document
    view won't get repainted.
    
    Change-Id: I4ec591aacf514bef8c5a66a7e674b0cee3b7201a

diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index e403be9..335f45a 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -297,7 +297,17 @@ void SwViewShellImp::UpdateAccessible()
     OSL_ENSURE( pWin, "no window, no access" );
 
     if( IsAccessible() && rIDLA.GetCurrentViewShell() && pWin )
-        GetAccessibleMap().GetDocumentView();
+    {
+        try
+        {
+            GetAccessibleMap().GetDocumentView();
+        }
+        catch (uno::Exception const& e)
+        {
+            SAL_WARN("sw.a11y", "exception: " << e.Message);
+            assert(!"SwViewShellImp::UpdateAccessible: unhandled exception");
+        }
+    }
 }
 
 void SwViewShellImp::DisposeAccessible(const SwFrame *pFrame,
commit ffb5bf421f5c0c565128116df40318f5b707b821
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 15 23:00:25 2016 +0100

    svx: remove nonsense exception throwing code
    
    Commit 60f11adb950e4f9645cc9ecb0f5af8235cc97366 added code to
    AccessibleShape::getAccessibleStateSet() that tries to retrieve some
    state from the parent, but the implementation of the base class
    AccessibleContextBase::getAccessibleParent() throws if it is already
    disposed, which is the condition checked just before, so surely
    this doesn't have any other effect than throw DisposedException,
    except possibly in the mpText == null case which is already
    handled in the other branch with identical code.
    
    Change-Id: Iaf109f69036437989abbbf914ef32cca1528a97e

diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index b7a23a8..8df4e04 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -410,38 +410,10 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
     ::osl::MutexGuard aGuard (maMutex);
     Reference<XAccessibleStateSet> xStateSet;
 
-    if (rBHelper.bDisposed || mpText == nullptr)
-        // Return a minimal state set that only contains the DEFUNC state.
+    if (IsDisposed())
     {
+        // Return a minimal state set that only contains the DEFUNC state.
         xStateSet = AccessibleContextBase::getAccessibleStateSet ();
-        ::utl::AccessibleStateSetHelper* pStateSet =
-              static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
-        css::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
-        if( xTempAcc.is() )
-        {
-            css::uno::Reference<XAccessibleContext>
-                                    xTempAccContext = xTempAcc->getAccessibleContext();
-            if( xTempAccContext.is() )
-            {
-                css::uno::Reference<XAccessibleStateSet> rState =
-                    xTempAccContext->getAccessibleStateSet();
-                if( rState.is() )           {
-                    css::uno::Sequence<short> aStates = rState->getStates();
-                    int count = aStates.getLength();
-                    for( int iIndex = 0;iIndex < count;iIndex++ )
-                    {
-                        if( aStates[iIndex] == AccessibleStateType::EDITABLE )
-                        {
-                            pStateSet->AddState (AccessibleStateType::EDITABLE);
-                            pStateSet->AddState (AccessibleStateType::RESIZABLE);
-                            pStateSet->AddState (AccessibleStateType::MOVEABLE);
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-        xStateSet.set( new ::utl::AccessibleStateSetHelper (*pStateSet));
     }
     else
     {
commit 5a3b2111172f106378cbf78aba0fde1db3642275
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 15 22:46:08 2016 +0100

    tdf#104488 editeng,svx: throw less Accessible exceptions
    
    For some of these functions it doesn't make sense to throw
    DisposedException as they can return a sensible default value.
    
    Particularly AccessibleShape::getAccessibleChildCount() was throwing an
    exception that was never caught.
    
    Change-Id: I000149cf9bb0fd13f69650ad8224a8daf26f7bee

diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx
index 57d9f36..1b92baa 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -173,7 +173,6 @@ uno::Reference< XAccessibleContext> SAL_CALL
     AccessibleContextBase::getAccessibleContext()
     throw (uno::RuntimeException, std::exception)
 {
-    ThrowIfDisposed ();
     return this;
 }
 
@@ -186,7 +185,6 @@ sal_Int32 SAL_CALL
        AccessibleContextBase::getAccessibleChildCount()
     throw (uno::RuntimeException, std::exception)
 {
-    ThrowIfDisposed ();
     return 0;
 }
 
@@ -418,7 +416,6 @@ void SAL_CALL AccessibleContextBase::removeAccessibleEventListener (
 OUString SAL_CALL AccessibleContextBase::getImplementationName()
     throw (css::uno::RuntimeException, std::exception)
 {
-    ThrowIfDisposed ();
     return OUString("AccessibleContextBase");
 }
 
@@ -432,7 +429,6 @@ uno::Sequence< OUString > SAL_CALL
        AccessibleContextBase::getSupportedServiceNames()
     throw (css::uno::RuntimeException, std::exception)
 {
-    ThrowIfDisposed ();
     return {
         "com.sun.star.accessibility.Accessible",
         "com.sun.star.accessibility.AccessibleContext"};
@@ -445,8 +441,6 @@ uno::Sequence< css::uno::Type>
     AccessibleContextBase::getTypes()
     throw (css::uno::RuntimeException, std::exception)
 {
-    ThrowIfDisposed ();
-
     // This class supports no interfaces on its own.  Just return those
     // supported by the base class.
     return WeakComponentImplHelper::getTypes();
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 2313dbe..b7a23a8 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -326,7 +326,11 @@ sal_Int32 SAL_CALL
        AccessibleShape::getAccessibleChildCount ()
     throw (css::uno::RuntimeException, std::exception)
 {
-    ThrowIfDisposed ();
+    if (IsDisposed())
+    {
+        return 0;
+    }
+
     sal_Int32 nChildCount = 0;
 
     // Add the number of shapes that are children of this shape.


More information about the Libreoffice-commits mailing list