aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-12-03 16:13:41 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-12-03 21:46:29 +0100
commit355ff606853d885b9ad7c6e1549c3f25bfa48a2c (patch)
tree77f033d561601c75283247258f4c9ed12087c798 /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
parent96e321bc5cf3c1a6d52374a6f4070a438032b08d (diff)
tst_qqmlecmascript: Avoid memory leak on failure
Pick-to: 6.0 Change-Id: Icf31fbe473e5b0659cfe09d5bef8652c22a2b1ce Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 37e3a33442..31611f2f27 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -4587,16 +4587,15 @@ void tst_qqmlecmascript::importScripts()
return;
}
- QObject *object = component.create();
+ QScopedPointer<QObject> object {component.create()};
if (!errorMessage.isEmpty()) {
QVERIFY(!object);
} else {
- QVERIFY(object != nullptr);
+ QVERIFY(!object.isNull());
tst_qqmlecmascript::verifyContextLifetime(QQmlContextData::get(engine.rootContext()));
for (int i = 0; i < propertyNames.size(); ++i)
QCOMPARE(object->property(propertyNames.at(i).toLatin1().constData()), propertyValues.at(i));
- delete object;
}
engine.setImportPathList(importPathList);