aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmetatype
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-12-19 11:23:46 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-01-10 12:04:11 +0100
commitc6e63aa128b0cbf5000a57154aadf9a2e2f081ab (patch)
tree70503adb6c9917f283ebd4bf6b638069540a4199 /tests/auto/qml/qqmlmetatype
parent6567ac436263a25252d02eebca4ed80ac7e5254d (diff)
tst_qqmlmetatype.cpp: Avoid memory leaks
Change-Id: Ic4ff36e48a1ff5146ec44f58ed416fd24cce5330 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlmetatype')
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index 76185a97e0..72295044a5 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -307,7 +307,7 @@ void tst_qqmlmetatype::compositeType()
//Loading the test file also loads all composite types it imports
QQmlComponent c(&engine, testFileUrl("testImplicitComposite.qml"));
- QObject* obj = c.create();
+ QScopedPointer<QObject> obj(c.create());
QVERIFY(obj);
QQmlType type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0);
@@ -324,7 +324,7 @@ void tst_qqmlmetatype::externalEnums()
qmlRegisterSingletonType<ExternalEnums>("x.y.z", 1, 0, "ExternalEnums", ExternalEnums::create);
QQmlComponent c(&engine, testFileUrl("testExternalEnums.qml"));
- QObject *obj = c.create();
+ QScopedPointer<QObject> obj(c.create());
QVERIFY(obj);
QVariant a = obj->property("a");
QCOMPARE(a.type(), QVariant::Int);
@@ -552,7 +552,8 @@ void tst_qqmlmetatype::unregisterAttachedProperties()
QCOMPARE(attachedType.attachedPropertiesType(QQmlEnginePrivate::get(&e)),
attachedType.metaObject());
- QVERIFY(c.create());
+ QScopedPointer<QObject> obj(c.create());
+ QVERIFY(obj);
}
qmlClearTypeRegistrations();
@@ -571,7 +572,8 @@ void tst_qqmlmetatype::unregisterAttachedProperties()
QCOMPARE(attachedType.attachedPropertiesType(QQmlEnginePrivate::get(&e)),
attachedType.metaObject());
- QVERIFY(c.create());
+ QScopedPointer<QObject> obj(c.create());
+ QVERIFY(obj);
}
}