tst_qjsengine: Fix some memory leaks
Change-Id: Ie3244fb88e91df84837b3a8bac9e98fc75f2850c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
23249c6f51
commit
ea74a1a6c1
|
@ -3714,21 +3714,21 @@ void tst_QJSEngine::dynamicProperties()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
QJSEngine engine;
|
QJSEngine engine;
|
||||||
QObject *obj = new QObject;
|
QScopedPointer<QObject> obj(new QObject);
|
||||||
QJSValue wrapper = engine.newQObject(obj);
|
QJSValue wrapper = engine.newQObject(obj.data());
|
||||||
wrapper.setProperty("someRandomProperty", 42);
|
wrapper.setProperty("someRandomProperty", 42);
|
||||||
QCOMPARE(wrapper.property("someRandomProperty").toInt(), 42);
|
QCOMPARE(wrapper.property("someRandomProperty").toInt(), 42);
|
||||||
QVERIFY(!qmlContext(obj));
|
QVERIFY(!qmlContext(obj.data()));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QQmlEngine qmlEngine;
|
QQmlEngine qmlEngine;
|
||||||
QQmlComponent component(&qmlEngine);
|
QQmlComponent component(&qmlEngine);
|
||||||
component.setData("import QtQml 2.0; QtObject { property QtObject subObject: QtObject {} }", QUrl());
|
component.setData("import QtQml 2.0; QtObject { property QtObject subObject: QtObject {} }", QUrl());
|
||||||
QObject *root = component.create(nullptr);
|
QScopedPointer<QObject> root(component.create(nullptr));
|
||||||
QVERIFY(root);
|
QVERIFY(root);
|
||||||
QVERIFY(qmlContext(root));
|
QVERIFY(qmlContext(root.data()));
|
||||||
|
|
||||||
QJSValue wrapper = qmlEngine.newQObject(root);
|
QJSValue wrapper = qmlEngine.newQObject(root.data());
|
||||||
wrapper.setProperty("someRandomProperty", 42);
|
wrapper.setProperty("someRandomProperty", 42);
|
||||||
QVERIFY(!wrapper.hasProperty("someRandomProperty"));
|
QVERIFY(!wrapper.hasProperty("someRandomProperty"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue