summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/qt5/QtXAccessible.hxx5
-rw-r--r--vcl/qt5/QtAccessibleWidget.cxx7
2 files changed, 11 insertions, 1 deletions
diff --git a/vcl/inc/qt5/QtXAccessible.hxx b/vcl/inc/qt5/QtXAccessible.hxx
index 4f4285e8065b..ddb7849b641c 100644
--- a/vcl/inc/qt5/QtXAccessible.hxx
+++ b/vcl/inc/qt5/QtXAccessible.hxx
@@ -28,6 +28,11 @@ class QtXAccessible : public QObject
public:
QtXAccessible(css::uno::Reference<css::accessibility::XAccessible> xAccessible);
+
+ /** Reference to the XAccessible.
+ * This is cleared once it has been passed to the QtAccessibleWidget,
+ * which then keeps an own reference and takes care of all required
+ * access to the XAccessible for the Qt a11y bridge. */
css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
};
diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index 83733e04c285..09d01c6e496f 100644
--- a/vcl/qt5/QtAccessibleWidget.cxx
+++ b/vcl/qt5/QtAccessibleWidget.cxx
@@ -749,7 +749,12 @@ QAccessibleInterface* QtAccessibleWidget::customFactory(const QString& classname
{
QtXAccessible* pXAccessible = static_cast<QtXAccessible*>(object);
if (pXAccessible && pXAccessible->m_xAccessible.is())
- return new QtAccessibleWidget(pXAccessible->m_xAccessible, object);
+ {
+ QtAccessibleWidget* pRet = new QtAccessibleWidget(pXAccessible->m_xAccessible, object);
+ // clear the reference in the QtXAccessible, no longer needed now that the QtAccessibleWidget holds one
+ pXAccessible->m_xAccessible.clear();
+ return pRet;
+ }
}
return nullptr;