summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-09-13 14:39:33 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-14 15:36:29 +0000
commitb18ed7089f22839621883e5a9e3903c22128b21a (patch)
tree69d667a187844177664e9257497a073fcec1080c
parent0542ef86ea051dd9e5ec135c3c1f520e21a0f3b3 (diff)
Avoid crashing with unparented accessibility
We do not get the automation id in this case then, but we have run without it before. Fixes: QTBUG-106588 Change-Id: Ib65f1aaff1d7ef260df56c7de7198b0679e0d644 Reviewed-by: Michal Klocek <michal.klocek@qt.io> (cherry picked from commit a79afbeaa0d5a0fe1152c221c063cf8e7304ed73) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/core/browser_accessibility_qt.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index 1d4fb06af..35d5b49d4 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -148,12 +148,12 @@ BrowserAccessibilityQt::~BrowserAccessibilityQt()
BrowserAccessibilityInterface::BrowserAccessibilityInterface(BrowserAccessibilityQt *chromiumInterface)
: q(chromiumInterface)
{
- Q_ASSERT(parent());
- Q_ASSERT(parent()->object());
- m_object = new QObject(parent()->object());
- QString name = toQt(q->GetAuthorUniqueId());
- if (!name.isEmpty())
- m_object->setObjectName(name);
+ if (parent() && parent()->object()) {
+ m_object = new QObject(parent()->object());
+ QString name = toQt(q->GetAuthorUniqueId());
+ if (!name.isEmpty())
+ m_object->setObjectName(name);
+ }
m_id = QAccessible::registerAccessibleInterface(this);
}