diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlengine/data/testGCCorruption.qml | 29 | ||||
-rw-r--r-- | tests/auto/qml/qqmlengine/tst_qqmlengine.cpp | 11 |
2 files changed, 39 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlengine/data/testGCCorruption.qml b/tests/auto/qml/qqmlengine/data/testGCCorruption.qml new file mode 100644 index 0000000000..8728b9b915 --- /dev/null +++ b/tests/auto/qml/qqmlengine/data/testGCCorruption.qml @@ -0,0 +1,29 @@ +import QtQml 2.0 + +QtObject { + id: root + property int count: 10000; + property var items: []; + + property Component component: Component { + id: component; + QtObject { + } + } + + property int iterations: 0 + Component.onCompleted: { + for (var iterations = 0; iterations < 5; ++iterations) { + for (var i=0; i<items.length; ++i) { + items[i].destroy(); + } + + for (var i=0; i<root.count; ++i) { + var object = component.createObject(); + items[i] = object + } + } + + // if we crash, then something bad has happened. :) + } +} diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index e170920486..3f6107ab2b 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -70,8 +70,8 @@ private slots: void qtqmlModule(); void urlInterceptor_data(); void urlInterceptor(); - void qmlContextProperties(); + void testGCCorruption(); public slots: QObject *createAQObjectForOwnershipTest () @@ -836,6 +836,15 @@ void tst_qqmlengine::qmlContextProperties() QVERIFY(o); } +void tst_qqmlengine::testGCCorruption() +{ + QQmlEngine e; + + QQmlComponent c(&e, testFileUrl("testGCCorruption.qml")); + QObject *o = c.create(); + QVERIFY2(o, qPrintable(c.errorString())); +} + QTEST_MAIN(tst_qqmlengine) #include "tst_qqmlengine.moc" |