Avoid memory leaks in tst_qquickloader.cpp

Change-Id: Id5cb654bd911fc42cf01606d376496d0c04d68f3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This commit is contained in:
Ulf Hermann 2022-11-24 14:15:17 +01:00
parent 303bfe42e8
commit 59c9b5d1f7
1 changed files with 12 additions and 12 deletions

View File

@ -906,9 +906,9 @@ void tst_QQuickLoader::asynchronous()
QFETCH(QStringList, expectedWarnings);
QQmlEngine engine;
PeriodicIncubationController *controller = new PeriodicIncubationController;
QScopedPointer<PeriodicIncubationController> controller(new PeriodicIncubationController);
QQmlIncubationController *previous = engine.incubationController();
engine.setIncubationController(controller);
engine.setIncubationController(controller.data());
delete previous;
QQmlComponent component(&engine, testFileUrl("asynchronous.qml"));
@ -945,9 +945,9 @@ void tst_QQuickLoader::asynchronous()
void tst_QQuickLoader::asynchronous_clear()
{
QQmlEngine engine;
PeriodicIncubationController *controller = new PeriodicIncubationController;
QScopedPointer<PeriodicIncubationController> controller(new PeriodicIncubationController);
QQmlIncubationController *previous = engine.incubationController();
engine.setIncubationController(controller);
engine.setIncubationController(controller.data());
delete previous;
QQmlComponent component(&engine, testFileUrl("asynchronous.qml"));
@ -993,9 +993,9 @@ void tst_QQuickLoader::asynchronous_clear()
void tst_QQuickLoader::simultaneousSyncAsync()
{
QQmlEngine engine;
PeriodicIncubationController *controller = new PeriodicIncubationController;
QScopedPointer<PeriodicIncubationController> controller(new PeriodicIncubationController);
QQmlIncubationController *previous = engine.incubationController();
engine.setIncubationController(controller);
engine.setIncubationController(controller.data());
delete previous;
QQmlComponent component(&engine, testFileUrl("simultaneous.qml"));
@ -1025,9 +1025,9 @@ void tst_QQuickLoader::simultaneousSyncAsync()
void tst_QQuickLoader::asyncToSync1()
{
QQmlEngine engine;
PeriodicIncubationController *controller = new PeriodicIncubationController;
QScopedPointer<PeriodicIncubationController> controller(new PeriodicIncubationController);
QQmlIncubationController *previous = engine.incubationController();
engine.setIncubationController(controller);
engine.setIncubationController(controller.data());
delete previous;
QQmlComponent component(&engine, testFileUrl("asynchronous.qml"));
@ -1057,9 +1057,9 @@ void tst_QQuickLoader::asyncToSync1()
void tst_QQuickLoader::asyncToSync2()
{
QQmlEngine engine;
PeriodicIncubationController *controller = new PeriodicIncubationController;
QScopedPointer<PeriodicIncubationController> controller(new PeriodicIncubationController);
QQmlIncubationController *previous = engine.incubationController();
engine.setIncubationController(controller);
engine.setIncubationController(controller.data());
delete previous;
QQmlComponent component(&engine, testFileUrl("asynchronous.qml"));
@ -1089,9 +1089,9 @@ void tst_QQuickLoader::asyncToSync2()
void tst_QQuickLoader::loadedSignal()
{
QQmlEngine engine;
PeriodicIncubationController *controller = new PeriodicIncubationController;
QScopedPointer<PeriodicIncubationController> controller(new PeriodicIncubationController);
QQmlIncubationController *previous = engine.incubationController();
engine.setIncubationController(controller);
engine.setIncubationController(controller.data());
delete previous;
{