QQuickItemViewTransitionAttached: Avoid dangling pointers
The items referred to here can be deleted when the animation finishes. Use QPointer to zero them in that case. Pick-to: 5.15 6.2 Fixes: QTBUG-84196 Change-Id: I695c9e91bd29d0583e4871d03ee946c40aa8a595 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
parent
813fb3ad45
commit
0118a2d6b6
|
@ -585,7 +585,7 @@ void QQuickItemViewTransitionableItem::stopTransition()
|
||||||
|
|
||||||
|
|
||||||
QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
|
QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent)
|
||||||
: QObject(parent), m_item(nullptr), m_index(-1)
|
: QObject(parent), m_index(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -226,7 +226,7 @@ private:
|
||||||
QList<int> m_targetIndexes;
|
QList<int> m_targetIndexes;
|
||||||
QList<QObject *> m_targetItems;
|
QList<QObject *> m_targetItems;
|
||||||
|
|
||||||
QQuickItem *m_item;
|
QPointer<QQuickItem> m_item;
|
||||||
int m_index;
|
int m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,12 @@ Window {
|
||||||
property int count: 0
|
property int count: 0
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
|
||||||
|
// This triggers the crash without retranslate().
|
||||||
|
// retranslate() got cleverer in 6.2, sidestepping the issue.
|
||||||
|
replaceExit.animations[0].target = null;
|
||||||
|
replaceExit.animations[0].target = replaceExit.ViewTransition.item
|
||||||
|
|
||||||
console.log("timer within", root, "is about to call retranslate")
|
console.log("timer within", root, "is about to call retranslate")
|
||||||
window.engine.retranslate()
|
window.engine.retranslate()
|
||||||
window.calledTranslate()
|
window.calledTranslate()
|
||||||
|
|
Loading…
Reference in New Issue