diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp index 89640bc385..cb4bee0d3a 100644 --- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp +++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp @@ -883,13 +883,13 @@ void tst_qqmlcontext::contextObjectHierarchy() QScopedPointer<QObject> root(component.create()); QVERIFY(!root.isNull()); - for (const QObject *child : root->children()) { - QQmlData *d = QQmlData::get(child); - QVERIFY(d->outerContext != nullptr); - connect(root.data(), &QObject::destroyed, [&]() { - QCOMPARE(d->outerContext, nullptr); - }); - } + for (const QObject *child : root->children()) + QVERIFY(QQmlData::get(child)->outerContext != nullptr); + + connect(root.data(), &QObject::destroyed, [&root]() { + for (const QObject *child : root->children()) + QCOMPARE(QQmlData::get(child)->outerContext, nullptr); + }); } QTEST_MAIN(tst_qqmlcontext) |