summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-09-13 14:39:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-09-15 12:28:13 +0200
commit1d123e0301614d9f4b8c27787e3c52ae20731458 (patch)
tree8239367ab8340b92663e38b8304030c252eb8f5f /src/core
parentbd949de2d3ba010bce863366cb2f45a7037b34ad (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)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/browser_accessibility_qt.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index 7b4a02647..b3f0c6fa2 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -802,12 +802,13 @@ void BrowserAccessibilityInterface::init()
{
if (m_id)
return;
- 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);
}