summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-09-11 16:17:47 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-09-12 07:08:14 +0200
commite94a35275670e0e3775c1bba305115d9941751f1 (patch)
tree586858758001c5659e301c6b61fbaa97e1b2b1ce /vcl
parent071b626079243908cfa85a5bd49620235fdf48cf (diff)
tdf#161256 gtk4 a11y: Don't crash on missing context or invalid child index
If an `XAccessible` doesn't have a context or `XAccessibleContext::getAccessibleIndexInParent()` returns an invalid index of -1, don't crash/assert, but let `lo_accessible_get_next_accessible_sibling` return `nullptr`. This works around potential bugs in underlying `XAccessible`/`XAccessibleContext` implementations for now. This is meant to fix the assert/crash seen in the backtraces attachment 196363 and attachment 196383 from tdf#161256 which I cannot reproduce locally on Debian testing. Change-Id: Ic1779d875161469bf296c558039e19f1d426a259 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173216 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk4/a11y.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx
index afa6905de553..1f864eaed960 100644
--- a/vcl/unx/gtk4/a11y.cxx
+++ b/vcl/unx/gtk4/a11y.cxx
@@ -763,8 +763,18 @@ static GtkAccessible* lo_accessible_get_next_accessible_sibling(GtkAccessible* s
css::uno::Reference<css::accessibility::XAccessibleContext> xContext(
pAccessible->uno_accessible->getAccessibleContext());
+ if (!xContext.is())
+ {
+ SAL_WARN("vcl.gtk", "Accessible has no accessible context");
+ return nullptr;
+ }
+
sal_Int64 nThisChildIndex = xContext->getAccessibleIndexInParent();
- assert(nThisChildIndex != -1);
+ if (nThisChildIndex < 0)
+ {
+ SAL_WARN("vcl.gtk", "Invalid accessible index in parent");
+ return nullptr;
+ }
sal_Int64 nNextChildIndex = nThisChildIndex + 1;
css::uno::Reference<css::accessibility::XAccessible> xParent = xContext->getAccessibleParent();