From d76efbe8efab30eddbdf48b77fbbec712e2e7652 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 28 Feb 2022 15:28:34 +0100 Subject: QQuickLoader: Check for QQmlEngine before using it The loader's context may have been removed from the context hierarchy or it may not have a context in the first place. We should not crash then. Fixes: QTBUG-67950 Change-Id: I1058d5b1f978aa040f8b2f018c4357dd7a3ef333 Reviewed-by: Fabian Kosmale (cherry picked from commit 79e885537f8546a18d7d9d902d6efe40b1915c96) --- tests/auto/quick/qquickloader/data/noEngine.qml | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/auto/quick/qquickloader/data/noEngine.qml (limited to 'tests/auto/quick/qquickloader/data/noEngine.qml') diff --git a/tests/auto/quick/qquickloader/data/noEngine.qml b/tests/auto/quick/qquickloader/data/noEngine.qml new file mode 100644 index 0000000000..19e619f32e --- /dev/null +++ b/tests/auto/quick/qquickloader/data/noEngine.qml @@ -0,0 +1,32 @@ +import QtQuick 2 + +Item { + id: root + property bool a: false + property int changes: 0 + onAChanged: { + m.model = 0 + m.model = 1 + ++changes; + } + + Repeater { + id: m + model: 1 + + Item { + Timer { + onTriggered: { + root.a = true + l.source = "loaded.qml" + } + interval: 0 + running: true + } + + Loader { + id: l + } + } + } +} -- cgit v1.2.3