aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmltimer
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmltimer')
-rw-r--r--tests/auto/qml/qqmltimer/tst_qqmltimer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
index cadc308961..587c85094c 100644
--- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
+++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
@@ -69,7 +69,8 @@ void tst_qqmltimer::notRepeating()
QQmlEngine engine;
QQmlComponent component(&engine);
component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile(""));
- QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ std::unique_ptr<QObject> o { component.create() };
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(o.get());
QVERIFY(timer != nullptr);
QVERIFY(timer->isRunning());
QVERIFY(!timer->isRepeating());
@@ -355,7 +356,8 @@ void tst_qqmltimer::stopWhenEventPosted()
QQmlEngine engine;
QQmlComponent component(&engine);
component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 200; running: true }"), QUrl::fromLocalFile(""));
- QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ std::unique_ptr<QObject> o { component.create() };
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(o.get());
TimerHelper helper;
connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
@@ -379,7 +381,8 @@ void tst_qqmltimer::restartWhenEventPosted()
QQmlEngine engine;
QQmlComponent component(&engine);
component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 200; running: true }"), QUrl::fromLocalFile(""));
- QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ std::unique_ptr<QObject> o { component.create() };
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(o.get());
TimerHelper helper;
connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));