aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-12-03 16:13:41 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-03 23:08:41 +0000
commit6863f4b1d27d3e43e97ce316404fec96b8368aae (patch)
tree68c8f26173b46b490018094dda535733464ba6cd /tests
parent5d7468d56f9c9100e613d4c3516394b5983e6291 (diff)
tst_qqmlecmascript: Avoid memory leak on failure
Change-Id: Icf31fbe473e5b0659cfe09d5bef8652c22a2b1ce Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 355ff606853d885b9ad7c6e1549c3f25bfa48a2c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-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);