summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-10-23 12:04:54 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-10-23 20:35:52 +0200
commitf1dbbfe278c8673d98e2eb3d8ad460b9f7364642 (patch)
tree8ed567deb57ee0e2f4fcfa57bf9769d5843c509c /accessibility
parentaf2457dd1f421d657f8d2ad3e2d8493ab9288d4d (diff)
a11y: Don't throw exception on valid list box entry action index
`checkActionIndex_Impl` was previously throwing an IndexOutOfBoundsException for any index other than 0. The // only three actions comment in there was only adding to the confusion... Convert that helper function to a method of the class and take the actual count of actions into account. Also drop the misleading `ACCESSIBLE_ACTION_COUNT` define altogether, and just return 1 at the only remaining place using it. This fixes a crash seen with the qt6 VCL plugin and Orca running when opening the spelling options dialog ("Tools" -> "Spelling", then press the "Options..." button). 1 __pthread_kill_implementation pthread_kill.c 44 0x7f29908a80fc 2 __pthread_kill_internal pthread_kill.c 78 0x7f29908a815f 3 __GI_raise raise.c 26 0x7f299085a472 4 __GI_abort abort.c 79 0x7f29908444b2 5 ?? 0x7f29904a09db 6 ?? 0x7f29904affaa 7 std::terminate() 0x7f29904b0015 8 __cxa_throw 0x7f29904b0268 9 (anonymous namespace)::checkActionIndex_Impl accessiblelistboxentry.cxx 49 0x7f29562aeb82 10 accessibility::AccessibleListBoxEntry::getAccessibleActionDescription accessiblelistboxentry.cxx 770 0x7f29562b2b9b 11 QtAccessibleWidget::actionNames QtAccessibleWidget.cxx 805 0x7f297c84a8d7 12 QAccessibleBridgeUtils::effectiveActionNames qaccessiblebridgeutils.cpp 25 0x7f297b6c90a5 13 AtSpiAdaptor::actionInterface atspiadaptor.cpp 1862 0x7f297b6e2cc0 14 AtSpiAdaptor::handleMessage atspiadaptor.cpp 1438 0x7f297b6de432 15 QDBusConnectionPrivate::activateObject qdbusintegrator.cpp 1438 0x7f2979ec0ecb 16 QDBusActivateObjectEvent::placeMetaCall qdbusintegrator.cpp 1594 0x7f2979ec1bb0 17 QObject::event qobject.cpp 1446 0x7f297c02116e 18 QApplicationPrivate::notify_helper qapplication.cpp 3295 0x7f297a59d714 19 QApplication::notify qapplication.cpp 3246 0x7f297a59d524 20 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1131 0x7f297bfa23ba 21 QCoreApplication::sendEvent qcoreapplication.cpp 1572 0x7f297bfa2ead 22 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1937 0x7f297bfa3ea6 23 QCoreApplication::sendPostedEvents qcoreapplication.cpp 1794 0x7f297bfa37ae 24 postEventSourceDispatch qeventdispatcher_glib.cpp 244 0x7f297c3b9108 25 ?? 0x7f29835111b4 26 ?? 0x7f29835142d7 27 g_main_context_iteration 0x7f29835148f0 28 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 394 0x7f297c3b999d 29 QXcbGlibEventDispatcher::processEvents qxcbeventdispatcher.cpp 96 0x7f2979c67036 30 QtInstance::ImplYield QtInstance.cxx 421 0x7f297c8c27c6 31 QtInstance::DoYield QtInstance.cxx 432 0x7f297c8c28ef 32 ImplYield svapp.cxx 377 0x7f298732dcc8 33 Application::Yield svapp.cxx 461 0x7f298732ea66 34 Application::Execute svapp.cxx 355 0x7f298732d9bb 35 desktop::Desktop::Main app.cxx 1601 0x7f2990a35716 36 ImplSVMain svmain.cxx 204 0x7f298734d600 37 SVMain svmain.cxx 236 0x7f298734d735 38 soffice_main sofficemain.cxx 94 0x7f2990aa058f 39 sal_main main.c 51 0x5629220af9d4 40 main main.c 49 0x5629220af9ba Change-Id: Ib3ed8616fb539942d9ba0cd60d5607859deb5a7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158344 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/inc/extended/accessiblelistboxentry.hxx2
-rw-r--r--accessibility/source/extended/accessiblelistboxentry.cxx28
2 files changed, 12 insertions, 18 deletions
diff --git a/accessibility/inc/extended/accessiblelistboxentry.hxx b/accessibility/inc/extended/accessiblelistboxentry.hxx
index 52964a80c4d1..050dc948d9c4 100644
--- a/accessibility/inc/extended/accessiblelistboxentry.hxx
+++ b/accessibility/inc/extended/accessiblelistboxentry.hxx
@@ -94,6 +94,8 @@ namespace accessibility
/// @throws css::lang::DisposedException
/// @throws css::uno::RuntimeException
tools::Rectangle GetBoundingBoxOnScreen();
+ /// @throws css::lang::IndexOutOfBoundsException
+ void CheckActionIndex(sal_Int32 nIndex);
/// @throws css::lang::DisposedException
void EnsureIsAlive() const;
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx
index 1f93476daa6a..69feac418805 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -37,20 +37,6 @@
#include <helper/accresmgr.hxx>
#include <strings.hrc>
-#define ACCESSIBLE_ACTION_COUNT 1
-
-namespace
-{
- /// @throws css::lang::IndexOutOfBoundsException
- void checkActionIndex_Impl( sal_Int32 _nIndex )
- {
- if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT )
- // only three actions
- throw css::lang::IndexOutOfBoundsException();
- }
-}
-
-
namespace accessibility
{
// class AccessibleListBoxEntry -----------------------------------------------------
@@ -197,6 +183,12 @@ namespace accessibility
return GetBoundingBoxOnScreen_Impl();
}
+ void AccessibleListBoxEntry::CheckActionIndex(sal_Int32 nIndex)
+ {
+ if (nIndex < 0 || nIndex >= getAccessibleActionCount())
+ throw css::lang::IndexOutOfBoundsException();
+ }
+
void AccessibleListBoxEntry::EnsureIsAlive() const
{
if ( !IsAlive_Impl() )
@@ -720,7 +712,7 @@ namespace accessibility
return 0;
}
else
- return ACCESSIBLE_ACTION_COUNT;
+ return 1;
return 0;
}
@@ -730,7 +722,7 @@ namespace accessibility
::osl::MutexGuard aGuard( m_aMutex );
bool bRet = false;
- checkActionIndex_Impl( nIndex );
+ CheckActionIndex(nIndex);
EnsureIsAlive();
SvTreeFlags treeFlag = m_pTreeListBox->GetTreeFlags();
@@ -767,7 +759,7 @@ namespace accessibility
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- checkActionIndex_Impl( nIndex );
+ CheckActionIndex(nIndex);
EnsureIsAlive();
SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath );
@@ -803,7 +795,7 @@ namespace accessibility
Reference< XAccessibleKeyBinding > AccessibleListBoxEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex )
{
Reference< XAccessibleKeyBinding > xRet;
- checkActionIndex_Impl( nIndex );
+ CheckActionIndex(nIndex);
// ... which key?
return xRet;
}