Author: hdu
Date: Mon Jun 23 07:55:44 2014
New Revision: 1604709

URL: http://svn.apache.org/r1604709
Log:
#i124970# fix DocumentFocusListener::notifyEvent's handling of 
IndexOutOfBoundsException

the DocumentFocusListener::notifyEvent() throw list only allows a 
RuntimeException to
propagate. The methods called in notifyEvent() allow IndexOutOfBoundsException 
though,
so it must be handled in all cases to prevent C++ from invoking its 
unexpected() abort
mechanisms. Ceterum censeo, non-empty throw lists should be removed 
altogether...

Modified:
    openoffice/trunk/main/vcl/aqua/source/a11y/documentfocuslistener.cxx
    openoffice/trunk/main/vcl/unx/gtk/a11y/atkutil.cxx

Modified: openoffice/trunk/main/vcl/aqua/source/a11y/documentfocuslistener.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/aqua/source/a11y/documentfocuslistener.cxx?rev=1604709&r1=1604708&r2=1604709&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/aqua/source/a11y/documentfocuslistener.cxx 
(original)
+++ openoffice/trunk/main/vcl/aqua/source/a11y/documentfocuslistener.cxx Mon 
Jun 23 07:55:44 2014
@@ -65,10 +65,10 @@ void SAL_CALL 
 DocumentFocusListener::notifyEvent( const AccessibleEventObject& aEvent ) 
     throw( RuntimeException )
 {
-    switch( aEvent.EventId )
-    {
-        case AccessibleEventId::STATE_CHANGED:
-            try 
+    try {
+        switch( aEvent.EventId )
+        {
+            case AccessibleEventId::STATE_CHANGED:
             {
                 sal_Int16 nState = AccessibleStateType::INVALID;
                 aEvent.NewValue >>= nState;
@@ -76,34 +76,35 @@ DocumentFocusListener::notifyEvent( cons
                 if( AccessibleStateType::FOCUSED == nState )
                     m_aFocusTracker.setFocusedObject( getAccessible(aEvent) );
             }
-            catch(IndexOutOfBoundsException e)
-            {
-                OSL_TRACE("Focused object has invalid index in parent");
-            }
             break;
             
-        case AccessibleEventId::CHILD:
-        {
-            Reference< XAccessible > xChild;
-            if( (aEvent.OldValue >>= xChild) && xChild.is() )
-                detachRecursive(xChild);
+            case AccessibleEventId::CHILD:
+            {
+                Reference< XAccessible > xChild;
+                if( (aEvent.OldValue >>= xChild) && xChild.is() )
+                    detachRecursive(xChild);
             
-            if( (aEvent.NewValue >>= xChild) && xChild.is() )
-                attachRecursive(xChild);
-        }
+                if( (aEvent.NewValue >>= xChild) && xChild.is() )
+                    attachRecursive(xChild);
+            }
             break;
             
-        case AccessibleEventId::INVALIDATE_ALL_CHILDREN:
-        {
-            Reference< XAccessible > xAccessible( getAccessible(aEvent) );
-            detachRecursive(xAccessible);
-            attachRecursive(xAccessible);
-        }
-
+            case AccessibleEventId::INVALIDATE_ALL_CHILDREN:
+            {
+                Reference< XAccessible > xAccessible( getAccessible(aEvent) );
+                detachRecursive(xAccessible);
+                attachRecursive(xAccessible);
+            }
             OSL_TRACE( "Invalidate all children called\n" );
             break;
-        default:
-            break;
+
+            default:
+                break;
+        }
+    }
+    catch(IndexOutOfBoundsException e)
+    {
+        OSL_TRACE("Focused object has invalid index in parent");
     }
 }
 

Modified: openoffice/trunk/main/vcl/unx/gtk/a11y/atkutil.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/unx/gtk/a11y/atkutil.cxx?rev=1604709&r1=1604708&r2=1604709&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/unx/gtk/a11y/atkutil.cxx (original)
+++ openoffice/trunk/main/vcl/unx/gtk/a11y/atkutil.cxx Mon Jun 23 07:55:44 2014
@@ -202,10 +202,10 @@ void DocumentFocusListener::disposing( c
 void DocumentFocusListener::notifyEvent( const 
accessibility::AccessibleEventObject& aEvent )
     throw( uno::RuntimeException )
 {
-    switch( aEvent.EventId )
-    {
-        case accessibility::AccessibleEventId::STATE_CHANGED:
-            try
+    try {
+        switch( aEvent.EventId )
+        {
+            case accessibility::AccessibleEventId::STATE_CHANGED:
             {
                 sal_Int16 nState = accessibility::AccessibleStateType::INVALID;
                 aEvent.NewValue >>= nState;
@@ -213,34 +213,36 @@ void DocumentFocusListener::notifyEvent(
                 if( accessibility::AccessibleStateType::FOCUSED == nState )
                     atk_wrapper_focus_tracker_notify_when_idle( 
getAccessible(aEvent) );
             }
-            catch(const lang::IndexOutOfBoundsException &e)
-            {
-                g_warning("Focused object has invalid index in parent");
-            }
             break;
 
-        case accessibility::AccessibleEventId::CHILD:
-        {
-            uno::Reference< accessibility::XAccessible > xChild;
-            if( (aEvent.OldValue >>= xChild) && xChild.is() )
-                detachRecursive(xChild);
+            case accessibility::AccessibleEventId::CHILD:
+            {
+                uno::Reference< accessibility::XAccessible > xChild;
+                if( (aEvent.OldValue >>= xChild) && xChild.is() )
+                    detachRecursive(xChild);
 
-            if( (aEvent.NewValue >>= xChild) && xChild.is() )
-                attachRecursive(xChild);
-        }
+                if( (aEvent.NewValue >>= xChild) && xChild.is() )
+                    attachRecursive(xChild);
+            }
             break;
 
-        case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN:
+            case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN:
 /*        {
             uno::Reference< accessibility::XAccessible > xAccessible( 
getAccessible(aEvent) );
             detachRecursive(xAccessible);
             attachRecursive(xAccessible);
-        }
+          }
 */
             g_warning( "Invalidate all children called\n" );
             break;
-        default:
-            break;
+
+            default:
+                break;
+        }
+    }
+    catch( const lang::IndexOutOfBoundsException& e )
+    {
+        g_warning("Focused object has invalid index in parent");
     }
 }
 


Reply via email to