aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
diff options
context:
space:
mode:
authorYulong Bai <yulong.bai@qt.io>2019-06-19 15:05:28 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2019-06-26 12:37:29 +0000
commitb8a85408d943bffba403d783b9082bd279460bed (patch)
tree943887cbe495b8182930ac24325ce043f47b5374 /tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
parent5eceb1801ec881947f80f70f32ea46e00926194f (diff)
QQuickItemView: fix crash while doing fast flicking in transitions
The cause was that fast flicking kicked items in and out of viewport, while in transition, they would abruptly having tracking data structure , i.e. releasePendingTransition of QQuickItemViewPrivate, got iterator invalidated. This also helps to resolve QTBUG-44308. Fixes: QTBUG-76433 Fixes: QTBUG-44308 Change-Id: If14533d3f6b1acd7b6ca0c5c723347c0cb3f54dc Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickanimations/tst_qquickanimations.cpp')
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index 1dad0c771c..d9b42bdeb5 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -40,6 +40,7 @@
#include <QtQuick/private/qquickanimatorjob_p.h>
#include <QtQuick/private/qquickpathinterpolator_p.h>
#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquicklistview_p.h>
#include <QEasingCurve>
#include <limits.h>
@@ -110,6 +111,7 @@ private slots:
void finished();
void replacingTransitions();
void animationJobSelfDestruction();
+ void fastFlickingBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -1744,6 +1746,34 @@ void tst_qquickanimations::animationJobSelfDestruction()
QTest::qWait(1000);
}
+void tst_qquickanimations::fastFlickingBug()
+{
+ // Don't crash
+ QQmlEngine engine;
+ engine.clearComponentCache();
+ QQmlComponent c(&engine, testFileUrl("fastFlickingBug.qml"));
+ QScopedPointer<QQuickWindow> win(qobject_cast<QQuickWindow*>(c.create()));
+ if (!c.errors().isEmpty())
+ qDebug() << c.errorString();
+ QVERIFY(win);
+ win->setTitle(QTest::currentTestFunction());
+ win->show();
+ QVERIFY(QTest::qWaitForWindowExposed(win.data()));
+ auto timer = win->property("timer").value<QQmlTimer*>();
+ QVERIFY(timer);
+ QCOMPARE(timer->isRunning(), false);
+ auto listView = win->property("listView").value<QQuickFlickable*>();
+ QVERIFY(listView);
+ timer->start();
+ // flick listView up and down quickly in the middle of a slow transition
+ for (int sign = 1; timer->isRunning(); sign *= -1) {
+ listView->flick(0, sign * 4000);
+ qApp->processEvents();
+ QTest::qWait(53);
+ qApp->processEvents();
+ }
+}
+
QTEST_MAIN(tst_qquickanimations)
#include "tst_qquickanimations.moc"