diff options
author | Nils Jeisecke <nils.jeisecke@saltation.com> | 2019-06-06 19:22:29 +0200 |
---|---|---|
committer | Nils Jeisecke <nils.jeisecke@saltation.com> | 2019-06-06 21:34:20 +0200 |
commit | ab933b1c92ec4f39ce280fdf956a4c4a746cf4d9 (patch) | |
tree | e5d8e03b500eb427ae6648aa5c696701099fcc0f /src/qml/jsapi | |
parent | 75075e4ef2b6f7f8de8f4baa12668f728545e697 (diff) |
Fix use after free crash in QQmlDelegateModel
When iterating over the cache in QQmlDelegateModel::_q_itemsInserted(),
_q_itemsRemoved, _q_itemsMoved, _q_modelReset() and _q_itemsMoved,
updating some of the item's modelIndex can trigger layout change in
the view, which might in turn remove a QQmlDelegateModelItem from
the cache, causing us to dereference an already deleted pointer.
To prevent a crash, we always check whether the item is still valid in
the original cache and skip it if it has been removed in the meanwhile.
This fix is similar to 5df747fc but reduces runtime impact by performing
the lookup only when d->m_cache has detached from the loop's copy.
Fixes: QTBUG-76254
Change-Id: I9d7e0118e64e9ec7d8efae04e6ae319804f31981
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/qml/jsapi')
0 files changed, 0 insertions, 0 deletions