diff options
author | Volker Hilsheimer <[email protected]> | 2025-04-30 09:57:25 +0200 |
---|---|---|
committer | Volker Hilsheimer <[email protected]> | 2025-06-05 08:41:39 +0200 |
commit | 9b9511c3548c43ce30117edb800af0c824fae26e (patch) | |
tree | a709c53c94d5a344ff8bcf28a9d4f7ed658247a0 | |
parent | 4720b592d729982faf85093b7511457b4945cf8d (diff) |
QTreeViewPrivate::doItemsLayout might get triggered when accessibility
elements query properties of items, such as the state or geometry. If we
reset the model immediately, then the items that are currently querying
might get destroyed, resulting in crashes.
Instead, use a queued invocation to reset the model only once control
returned to the event queue. This leaves current elements intact.
Amends 6a4afebc5ce8db69a6c9fb398cada31e6bad5e3c and follow-up commit
a86321cb665b1af03b245b3b0fe0b57faa4a678f.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136074
Task-number: QTBUG-133855
Change-Id: I2c6acda3b31105447393a6efcb85ddf737161fe8
Reviewed-by: Tor Arne Vestbø <[email protected]>
-rw-r--r-- | src/widgets/itemviews/qtreeview.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 2c040b2d635..23588d4917c 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2177,7 +2177,12 @@ void QTreeView::doItemsLayout() } QAbstractItemView::doItemsLayout(); d->header->doItemsLayout(); - d->updateAccessibility(); + // reset the accessibility representation of the view once control has + // returned to the event loop. This avoids that we destroy UI tree elements + // in the platform layer as part of a model-reset notification, while those + // elements respond to a query (i.e. of rect, which results in a call to + // doItemsLayout(). + QMetaObject::invokeMethod(this, [d]{ d->updateAccessibility(); }, Qt::QueuedConnection); } /*! |