diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2024-03-26 12:09:23 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-04-04 22:42:08 +0000 |
commit | 025b76866f51608d87b11c89c710d564c0d6e826 (patch) | |
tree | 3e62e7913b0796885f3591f636e2a605d9e886b0 /src/quick | |
parent | cb1e6fe1e589680dfcddf904655d08666b9fc4a1 (diff) |
QQuickTextEdit: Check QQuickAccessibleAttached for nullptr
If the host object is in the process of being deleted, the attached
object will be null. We cannot rule this out here, and crashes have been
reported.
Amends commmit 12517742fcbd40b2311b94abe840532eae3d8914
Pick-to: 6.7
Change-Id: I31fcab2999c8ab8c20f3a2cd58060cbbefa7de40
Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Kai Uwe Broulik <kde@privat.broulik.de>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 006d235af9..66615d9354 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -1015,10 +1015,11 @@ void QQuickTextEditPrivate::accessibilityActiveChanged(bool active) return; Q_Q(QQuickTextEdit); - QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true)); - Q_ASSERT(accessibleAttached); - accessibleAttached->setRole(effectiveAccessibleRole()); - accessibleAttached->set_readOnly(q->isReadOnly()); + if (QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>( + qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true))) { + accessibleAttached->setRole(effectiveAccessibleRole()); + accessibleAttached->set_readOnly(q->isReadOnly()); + } } QAccessible::Role QQuickTextEditPrivate::accessibleRole() const |