aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickrepeater
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-17 13:44:40 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-18 13:54:45 +0200
commit2fb17f3feefcca8862f6f908fe81957f34096c00 (patch)
treef85ccd98e2f578b41b609c542b40e22517593147 /tests/auto/quick/qquickrepeater
parent273fb1a2e8084a611ca9047c5d5a5ed26a521945 (diff)
Fix crash in repeater when model gets deleted
Task-number: QTBUG-200461 Change-Id: Ia8e48668960ac005cf773bf6f53da40f1c753b9b Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'tests/auto/quick/qquickrepeater')
-rw-r--r--tests/auto/quick/qquickrepeater/data/visualitemmodel.qml23
-rw-r--r--tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp12
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml b/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml
new file mode 100644
index 0000000000..b1b7b97881
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/visualitemmodel.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 360
+ height: 360
+
+ VisualItemModel {
+ id: visItemModel
+ Rectangle {
+ width: 20
+ height: 20
+ color: "red"
+ }
+ }
+
+ Column {
+ anchors.fill: parent
+ Repeater {
+ model: visItemModel
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
index 582503f938..9fb76f9584 100644
--- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
+++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
@@ -78,6 +78,7 @@ private slots:
void asynchronous();
void initParent();
void dynamicModelCrash();
+ void visualItemModelCrash();
};
class TestObject : public QObject
@@ -732,6 +733,17 @@ void tst_QQuickRepeater::dynamicModelCrash()
QVERIFY(qvariant_cast<QObject *>(repeater->model()) == 0);
}
+void tst_QQuickRepeater::visualItemModelCrash()
+{
+ // This used to crash because the model would get
+ // deleted before the repeater, leading to double-deletion
+ // of the items.
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("visualitemmodel.qml"));
+ qApp->processEvents();
+ delete window;
+}
+
QTEST_MAIN(tst_QQuickRepeater)
#include "tst_qquickrepeater.moc"