tdf#122056: catch DisposedException to avoid crash w/ screen reader
The repro scenario is closing a slideshow with screen reader on.
Some object are already disposed by the time [full-screen] win with
presentation closes
Change-Id: I7e2ae7a5b694daaf7355ef93d87a998c9f2e345a
Reviewed-on: https://gerrit.libreoffice.org/65931
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index c2c1fdc..efafab1 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <comphelper/AccessibleImplementationHelper.hxx>
@@ -662,8 +663,18 @@ QAccessibleInterface* Qt5AccessibleWidget::childAt(int x, int y) const
{
if (!m_xAccessible.is())
return nullptr;
Reference<XAccessibleComponent> xAccessibleComponent(m_xAccessible->getAccessibleContext(),
UNO_QUERY);
Reference<XAccessibleContext> xAc;
try
{
xAc = m_xAccessible->getAccessibleContext();
}
catch (css::lang::DisposedException /*ex*/)
{
return nullptr;
}
Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY);
return QAccessible::queryAccessibleInterface(
new Qt5XAccessible(xAccessibleComponent->getAccessibleAtPoint(awt::Point(x, y))));
}