Do not leak the item, and use a QScopedPointer to guarantee cleanup

Change-Id: Ib4160f418686cef6d85dfd64657d25836f66778e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Jan Arve Saether 2017-01-19 16:10:09 +01:00 committed by Jan Arve Sæther
parent 63ce81bb05
commit c4067b42f7
1 changed files with 1 additions and 2 deletions

View File

@ -469,7 +469,7 @@ void tst_QQuickLoader::networkComponent()
// because in the synchronous case we're already done loading.
QTRY_COMPARE(component.status(), QQmlComponent::Ready);
QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem*>(component.create()));
QVERIFY(item);
QQuickLoader *loader = qobject_cast<QQuickLoader*>(item->children().at(1));
@ -481,7 +481,6 @@ void tst_QQuickLoader::networkComponent()
QCOMPARE(loader->status(), QQuickLoader::Ready);
QCOMPARE(static_cast<QQuickItem*>(loader)->children().count(), 1);
delete loader;
}
void tst_QQuickLoader::failNetworkRequest()