From 19c0a31319148d4ac716f7cb3295891b5a3b20d9 Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Fri, 6 Jul 2012 09:53:03 +1000 Subject: Do not permit excessive recursion in component creation Limit recursion during component creation to prevent infinite recursion resulting in a crash. Recursion results from invoking createObject() in the Component.onCompleted handler. Task-number: QTBUG-25439 Change-Id: Ica2ba099d82b5747c938501af04e67f7ace8402e Reviewed-by: Michael Brasser --- .../qml/qqmlcomponent/data/recursionContinuation.qml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml (limited to 'tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml') diff --git a/tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml b/tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml new file mode 100644 index 0000000000..a10afd3ebe --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml @@ -0,0 +1,16 @@ +import QtQuick 2.0 + +Item { + id: root + + property bool success: false + + Component.onCompleted: { + for (var i = 0; i < 10; ++i) { + Qt.createComponent("RecursiveComponent.qml").createObject(root) + } + + var o = Qt.createComponent("TestComponent.qml").createObject(root) + root.success = (o != null) + } +} -- cgit v1.2.3