diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2017-02-04 13:24:15 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2017-02-07 11:50:02 +0000 |
commit | e9686b3718c396333c368e14cda48f407276c106 (patch) | |
tree | d62ce78885803efa5512415e8eb5d29c90090ccd /src/gui/accessible | |
parent | c7e49651f1945e6fb9dd7a4e74ff3c89259396f6 (diff) |
Protect against nullptr deref in QAccessibleEvent::uniqueId
This looks like an underlying issue in the model/view implementation
which relies on accessible interfaces that are not representing a qobject.
We know it's not perfect and needs fixing, but for now at least don't crash.
[ChangeLog][macOS][Accessibility] A common crash in accessibility on macOS was fixed.
See QTBUG-39008
Task-number: QTBUG-39008
Task-number: QTBUG-54776
Task-number: QTBUG-56043
Task-number: QTBUG-57146
Change-Id: I16b161914d4bc3cbc0beee37d468243bf7788d1e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 5ed724047f..2db4d46874 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1373,8 +1373,13 @@ QAccessible::Id QAccessibleEvent::uniqueId() const QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); if (!iface) return 0; - if (m_child != -1) + if (m_child != -1) { iface = iface->child(m_child); + if (Q_UNLIKELY(!iface)) { + qCWarning(lcAccessibilityCore) << "Invalid child in QAccessibleEvent:" << m_object << "child:" << m_child; + return 0; + } + } return QAccessible::uniqueId(iface); } |