1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
From 8e6b7d5696378e946e904c1df87da83e139af90d Mon Sep 17 00:00:00 2001
From: Michael Weghorn <m.weghorn@posteo.de>
Date: Mon, 7 Sep 2020 20:08:57 +0200
Subject: tdf#136323 qt5: Remember accessible object
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
'QAccessibleCache::insert' from the Qt library has a
'Q_ASSERT' checking that the corresponding 'QObject' for
which the 'QAccessibleInterface' provides information
is actually the same as the object passed as a parameter:
QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *iface) const
{
// ...
QObject *obj = iface->object();
-> Q_ASSERT(object == obj);
However, 'Qt5AccessibleWidget::object' so far was always returning
'nullptr', triggering this assert when using a Qt version
not built with 'QT_NO_DEBUG'.
To fix this, remember and return the object as needed.
Change-Id: I4015b4c37aa8a073b02465df580a7235884e6cf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102196
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 4461d49c6cfce22c2c96185b0a1d07bfe9709268)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102126
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
---
vcl/inc/qt5/Qt5AccessibleWidget.hxx | 4 +++-
vcl/qt5/Qt5AccessibleWidget.cxx | 9 +++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/vcl/inc/qt5/Qt5AccessibleWidget.hxx b/vcl/inc/qt5/Qt5AccessibleWidget.hxx
index 6b0d71cba9f5..0f62d2a8a5b8 100644
--- a/vcl/inc/qt5/Qt5AccessibleWidget.hxx
+++ b/vcl/inc/qt5/Qt5AccessibleWidget.hxx
@@ -41,7 +41,8 @@ class VCLPLUG_QT5_PUBLIC Qt5AccessibleWidget : public QObject,
Q_OBJECT
public:
- Qt5AccessibleWidget(const css::uno::Reference<css::accessibility::XAccessible> xAccessible);
+ Qt5AccessibleWidget(const css::uno::Reference<css::accessibility::XAccessible> xAccessible,
+ QObject* pObject);
QWindow* window() const override;
int childCount() const override;
int indexOfChild(const QAccessibleInterface* child) const override;
@@ -137,6 +138,7 @@ public:
private:
css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
css::uno::Reference<css::accessibility::XAccessibleContext> getAccessibleContextImpl() const;
+ QObject* m_pObject;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index 6a828865036e..7136e0823790 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -58,8 +58,9 @@ using namespace css::accessibility;
using namespace css::beans;
using namespace css::uno;
-Qt5AccessibleWidget::Qt5AccessibleWidget(const Reference<XAccessible> xAccessible)
+Qt5AccessibleWidget::Qt5AccessibleWidget(const Reference<XAccessible> xAccessible, QObject* pObject)
: m_xAccessible(xAccessible)
+ , m_pObject(pObject)
{
Reference<XAccessibleContext> xContext = xAccessible->getAccessibleContext();
Reference<XAccessibleEventBroadcaster> xBroadcaster(xContext, UNO_QUERY);
@@ -698,7 +699,7 @@ bool Qt5AccessibleWidget::isValid() const
return xAc.is();
}
-QObject* Qt5AccessibleWidget::object() const { return nullptr; }
+QObject* Qt5AccessibleWidget::object() const { return m_pObject; }
void Qt5AccessibleWidget::setText(QAccessible::Text /* t */, const QString& /* text */) {}
@@ -721,13 +722,13 @@ QAccessibleInterface* Qt5AccessibleWidget::customFactory(const QString& classnam
vcl::Window* pWindow = pWidget->frame().GetWindow();
if (pWindow)
- return new Qt5AccessibleWidget(pWindow->GetAccessible());
+ return new Qt5AccessibleWidget(pWindow->GetAccessible(), object);
}
if (classname == QLatin1String("Qt5XAccessible") && object)
{
Qt5XAccessible* pXAccessible = dynamic_cast<Qt5XAccessible*>(object);
if (pXAccessible && pXAccessible->m_xAccessible.is())
- return new Qt5AccessibleWidget(pXAccessible->m_xAccessible);
+ return new Qt5AccessibleWidget(pXAccessible->m_xAccessible, object);
}
return nullptr;
--
cgit v1.2.1
|