summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2025-03-21 20:18:06 +0100
committerTarja Sundqvist <tarja.sundqvist@qt.io>2025-03-21 20:18:06 +0100
commit17273547f1b0f6fd662b42b74c3995b8966e2f54 (patch)
tree91553c48f541ce36436e91313b878ff2c34701aa
parent6e67d3782b95fee6b7a880cff5c67f88fd1cc07a (diff)
parentac5d7584bf96bd78db132d904ce8809ec7cb9d66 (diff)
Merge tag 'v6.2.12-lts-lgpl' into 6.26.2
Qt 6.2.12-lts-lgpl release Change-Id: I2a3d98b88b4aff94a779e82e067732d36718e841
-rw-r--r--.cmake.conf2
-rw-r--r--coin/module_config.yaml8
-rw-r--r--dependencies.yaml8
-rw-r--r--examples/interfaceframework/qface-tutorial/doc/src/qface-tutorial.qdoc7
-rw-r--r--src/interfaceframework/qifpendingreply.h39
-rw-r--r--src/interfaceframework/qifproxyserviceobject.cpp5
-rw-r--r--src/interfaceframework/qifproxyserviceobject.h1
-rw-r--r--src/interfaceframework/qifqmlconversion_helper.cpp2
-rw-r--r--src/interfaceframework/qifservicemanager.cpp14
-rw-r--r--src/interfaceframework/qifservicemanager.h3
-rw-r--r--src/interfaceframework/qifsimulationengine.cpp11
-rw-r--r--src/tools/ifcodegen/deploy-virtualenv-files.txt1
-rw-r--r--src/tools/ifcodegen/templates/backend_qtro/backend.cpp.tpl4
-rw-r--r--src/tools/ifcodegen/templates/frontend/interface.cpp.tpl12
-rw-r--r--src/tools/ifcodegen/templates/frontend/interface_p.h.tpl1
-rw-r--r--src/tools/ifcodegen/templates/test/tst_test.cpp.tpl6
-rw-r--r--tests/auto/core/qifabstractfeature/tst_qifabstractfeature.cpp13
-rw-r--r--tests/auto/core/qiffilterandbrowsemodel/tst_qiffilterandbrowsemodel.cpp1
-rw-r--r--tests/auto/core/qifpagingmodel/tst_qifpagingmodel.cpp1
-rw-r--r--tests/auto/core/qifpendingreply/tst_qifpendingreply.cpp4
20 files changed, 88 insertions, 55 deletions
diff --git a/.cmake.conf b/.cmake.conf
index d9966ddc..897ec4a3 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -1 +1 @@
-set(QT_REPO_MODULE_VERSION "6.2.11")
+set(QT_REPO_MODULE_VERSION "6.2.12")
diff --git a/coin/module_config.yaml b/coin/module_config.yaml
index 03172473..a4b4fcc6 100644
--- a/coin/module_config.yaml
+++ b/coin/module_config.yaml
@@ -12,28 +12,28 @@ instructions:
variableValue: "1"
- type: AppendToEnvironmentVariable
variableName: NON_QTBASE_CONFIGURE_ARGS
- variableValue: " -DPython3_ROOT_DIR={{.Env.PYTHON3_PATH}}"
+ variableValue: " -DPython3_ROOT_DIR={{.Env.PYTHON3_PATH}} -DFEATURE_ifcodegen=ON"
disable_if:
condition: property
property: features
contains_value: UseConfigure
- type: AppendToEnvironmentVariable
variableName: NON_QTBASE_TARGET_CONFIGURE_ARGS
- variableValue: " -DPython3_ROOT_DIR={{.Env.PYTHON3_PATH}}"
+ variableValue: " -DPython3_ROOT_DIR={{.Env.PYTHON3_PATH}} -DFEATURE_ifcodegen=ON"
disable_if:
condition: property
property: features
contains_value: UseConfigure
- type: AppendToEnvironmentVariable
variableName: NON_QTBASE_CMAKE_ARGS
- variableValue: " -DPython3_ROOT_DIR={{.Env.PYTHON3_PATH}}"
+ variableValue: " -DPython3_ROOT_DIR={{.Env.PYTHON3_PATH}} -DFEATURE_ifcodegen=ON"
enable_if:
condition: property
property: features
contains_value: UseConfigure
- type: AppendToEnvironmentVariable
variableName: NON_QTBASE_TARGET_CMAKE_ARGS
- variableValue: " -DPython3_ROOT_DIR={{.Env.PYTHON3_PATH}}"
+ variableValue: " -DPython3_ROOT_DIR={{.Env.PYTHON3_PATH}} -DFEATURE_ifcodegen=ON"
enable_if:
condition: property
property: features
diff --git a/dependencies.yaml b/dependencies.yaml
index aab087b9..35a09338 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,13 +1,13 @@
dependencies:
../tqtc-qtdeclarative:
- ref: 3d6ea255dba81dd08532d56d4af6a56cb71940aa
+ ref: a7c766a9863605eb81e8f0cdb4d2b93e087b5bde
required: true
../tqtc-qtmultimedia:
- ref: 5b2aa29d4ef0f1cef09022f87a28b650660156fa
+ ref: 4d5cab73c0ca3c5f4cb486ca5297724ceba52e6f
required: true
../tqtc-qtremoteobjects:
- ref: 4388c0ac05f290b1707e9f7d25c7cc68dd61f728
+ ref: 4cf461596e01645c789ba6544fc79f47be151828
required: true
../tqtc-qttools:
- ref: 3818cdf1a1e511aa2bb9fab9347af7b7d9829d90
+ ref: a78a36d69a792ae66fc062e461b83c28152a6856
required: false
diff --git a/examples/interfaceframework/qface-tutorial/doc/src/qface-tutorial.qdoc b/examples/interfaceframework/qface-tutorial/doc/src/qface-tutorial.qdoc
index b1d21c45..4f3b98ff 100644
--- a/examples/interfaceframework/qface-tutorial/doc/src/qface-tutorial.qdoc
+++ b/examples/interfaceframework/qface-tutorial/doc/src/qface-tutorial.qdoc
@@ -116,9 +116,10 @@
\section2 Auto-generation
Now that our first version of the IDL file is ready, it's time to auto-generate an API from it,
- using the \l{Qt Interface Framework Generator}{Interface Framework Generator tool}. Similar to
- \l{Using the Meta-Object Compiler (moc)}{moc}, this auto-generation process is integrated into the
- build system and is done at compile time.
+ using the \l{Qt Interface Framework Generator}{Interface Framework Generator tool}. Using qmake
+ this auto-generation process is integrated into the build system and is done at compile time.
+ similar to \l{Using the Meta-Object Compiler (moc)}{moc}. With CMake, the generation happens
+ at configuration time.
In the following snippets we build a C++ library based on our IDL file:
diff --git a/src/interfaceframework/qifpendingreply.h b/src/interfaceframework/qifpendingreply.h
index c11ae687..93ff130b 100644
--- a/src/interfaceframework/qifpendingreply.h
+++ b/src/interfaceframework/qifpendingreply.h
@@ -150,17 +150,15 @@ public:
else if (failed)
failed();
} else {
- QSharedPointer<QIfPendingReplyWatcher> w = m_watcher;
+ QWeakPointer<QIfPendingReplyWatcher> w = m_watcher;
if (success) {
QObject::connect(watcher(), &QIfPendingReplyWatcher::replySuccess, watcher(), [success, w]() {
- success(w->value().value<T>());
- });
- }
- if (failed) {
- QObject::connect(watcher(), &QIfPendingReplyWatcher::replyFailed, watcher(), [failed]() {
- failed();
+ if (w)
+ success(w.toStrongRef()->value().value<T>());
});
}
+ if (failed)
+ QObject::connect(watcher(), &QIfPendingReplyWatcher::replyFailed, watcher(), failed);
}
}
@@ -199,17 +197,15 @@ public:
else if (failed)
failed();
} else {
- QSharedPointer<QIfPendingReplyWatcher> w = m_watcher;
+ QWeakPointer<QIfPendingReplyWatcher> w = m_watcher;
if (success) {
QObject::connect(watcher(), &QIfPendingReplyWatcher::replySuccess, watcher(), [success, w]() {
- success(w->value());
- });
- }
- if (failed) {
- QObject::connect(watcher(), &QIfPendingReplyWatcher::replyFailed, watcher(), [failed]() {
- failed();
+ if (w)
+ success(w.toStrongRef()->value());
});
}
+ if (failed)
+ QObject::connect(watcher(), &QIfPendingReplyWatcher::replyFailed, watcher(), failed);
}
}
@@ -244,17 +240,10 @@ public:
else if (failed)
failed();
} else {
- QSharedPointer<QIfPendingReplyWatcher> w = m_watcher;
- if (success) {
- QObject::connect(watcher(), &QIfPendingReplyWatcher::replySuccess, watcher(), [success, w]() {
- success();
- });
- }
- if (failed) {
- QObject::connect(watcher(), &QIfPendingReplyWatcher::replyFailed, watcher(), [failed]() {
- failed();
- });
- }
+ if (success)
+ QObject::connect(watcher(), &QIfPendingReplyWatcher::replySuccess, watcher(), success);
+ if (failed)
+ QObject::connect(watcher(), &QIfPendingReplyWatcher::replyFailed, watcher(), failed);
}
}
diff --git a/src/interfaceframework/qifproxyserviceobject.cpp b/src/interfaceframework/qifproxyserviceobject.cpp
index 028591e3..f75dc2ef 100644
--- a/src/interfaceframework/qifproxyserviceobject.cpp
+++ b/src/interfaceframework/qifproxyserviceobject.cpp
@@ -101,6 +101,11 @@ QIfProxyServiceObject::QIfProxyServiceObject(const QHash<QString, QIfFeatureInte
{
}
+QIfProxyServiceObject::~QIfProxyServiceObject()
+{
+ delete d_ptr;
+}
+
/*!
\reimp
*/
diff --git a/src/interfaceframework/qifproxyserviceobject.h b/src/interfaceframework/qifproxyserviceobject.h
index e8166b86..d10e006e 100644
--- a/src/interfaceframework/qifproxyserviceobject.h
+++ b/src/interfaceframework/qifproxyserviceobject.h
@@ -58,6 +58,7 @@ class Q_QTINTERFACEFRAMEWORK_EXPORT QIfProxyServiceObject : public QIfServiceObj
public:
explicit QIfProxyServiceObject(QIfServiceInterface *interface);
explicit QIfProxyServiceObject(const QHash<QString, QIfFeatureInterface*> &interfaceMap);
+ ~QIfProxyServiceObject() override;
QStringList interfaces() const override;
QIfFeatureInterface *interfaceInstance(const QString &interface) const override;
diff --git a/src/interfaceframework/qifqmlconversion_helper.cpp b/src/interfaceframework/qifqmlconversion_helper.cpp
index 307a18da..549b9c3c 100644
--- a/src/interfaceframework/qifqmlconversion_helper.cpp
+++ b/src/interfaceframework/qifqmlconversion_helper.cpp
@@ -145,6 +145,8 @@ QVariant qtif_convertFromJSON(const QVariant &value)
}
void *gadget = metaType.create();
+ auto cleanup = qScopeGuard([gadget, metaType] { metaType.destroy(gadget); });
+
if (!Q_UNLIKELY(gadget)) {
qWarning("Couldn't create a new instance of %s", metaType.name());
return QVariant();
diff --git a/src/interfaceframework/qifservicemanager.cpp b/src/interfaceframework/qifservicemanager.cpp
index e585d666..ea67e34d 100644
--- a/src/interfaceframework/qifservicemanager.cpp
+++ b/src/interfaceframework/qifservicemanager.cpp
@@ -513,8 +513,8 @@ QIfServiceInterface *QIfServiceManagerPrivate::loadServiceBackendInterface(struc
For more information about QIfServiceManager and how it works, see its \l{QIfServiceManager}{C++ documentation}.
*/
-QIfServiceManager::QIfServiceManager()
- : QAbstractListModel(nullptr)
+QIfServiceManager::QIfServiceManager(QObject *parent)
+ : QAbstractListModel(parent)
, d_ptr(new QIfServiceManagerPrivate(this))
{
QtInterfaceFrameworkModule::registerTypes();
@@ -526,10 +526,16 @@ QIfServiceManager::QIfServiceManager()
*/
QIfServiceManager *QIfServiceManager::instance()
{
- static auto *instance = new QIfServiceManager();
+ static auto *instance = new QIfServiceManager(qApp);
return instance;
}
+QIfServiceManager::~QIfServiceManager()
+{
+ unloadAllBackends();
+ delete d_ptr;
+}
+
/*!
\qmlmethod list<ServiceObject> ServiceManager::findServiceByInterface(interface, searchFlags)
@@ -564,6 +570,8 @@ QList<QIfServiceObject *> QIfServiceManager::findServiceByInterface(const QStrin
one interface, supported by the backend. The \a backendType indicates the type of the backend
and influences whether the backend can be found by the Feature's auto discovery option.
+ The ownership of \a serviceBackendInterface is transferred to the QIfServiceManager.
+
Returns \c true if the backend was successfully registered; otherwise \c false.
\sa QIfServiceInterface
diff --git a/src/interfaceframework/qifservicemanager.h b/src/interfaceframework/qifservicemanager.h
index ed4a2497..31f85138 100644
--- a/src/interfaceframework/qifservicemanager.h
+++ b/src/interfaceframework/qifservicemanager.h
@@ -77,6 +77,7 @@ public:
Q_ENUM(BackendType)
static QIfServiceManager *instance();
+ ~QIfServiceManager() override;
Q_INVOKABLE QList<QIfServiceObject*> findServiceByInterface(const QString &interface, QIfServiceManager::SearchFlags searchFlags = IncludeAll);
Q_INVOKABLE bool hasInterface(const QString &interface) const;
@@ -90,7 +91,7 @@ public:
QHash<int, QByteArray> roleNames() const override;
private:
- explicit QIfServiceManager();
+ explicit QIfServiceManager(QObject *parent = nullptr);
QIfServiceManagerPrivate * const d_ptr;
Q_DECLARE_PRIVATE(QIfServiceManager)
};
diff --git a/src/interfaceframework/qifsimulationengine.cpp b/src/interfaceframework/qifsimulationengine.cpp
index 370bcbd8..ca2b9335 100644
--- a/src/interfaceframework/qifsimulationengine.cpp
+++ b/src/interfaceframework/qifsimulationengine.cpp
@@ -292,14 +292,23 @@ using namespace qtif_helper;
\endcode
*/
+/*!
+ Constructs a new QIfSimulationEngine with the given \a parent.
+*/
QIfSimulationEngine::QIfSimulationEngine(QObject *parent)
: QIfSimulationEngine(QString(), parent)
{
}
+/*!
+ Constructs a new QIfSimulationEngine with the given \a identifier and \a parent.
+
+ The \a identifier can be used to override the simulation QML file or the simulation data file.
+ \sa Runtime Override
+*/
QIfSimulationEngine::QIfSimulationEngine(const QString &identifier, QObject *parent)
: QQmlApplicationEngine (parent)
- , m_globalObject(new QIfSimulationGlobalObject)
+ , m_globalObject(new QIfSimulationGlobalObject(this))
, m_identifier(identifier)
{
rootContext()->setContextProperty(QStringLiteral("IfSimulator"), m_globalObject);
diff --git a/src/tools/ifcodegen/deploy-virtualenv-files.txt b/src/tools/ifcodegen/deploy-virtualenv-files.txt
index a5cf0f66..13ab3a93 100644
--- a/src/tools/ifcodegen/deploy-virtualenv-files.txt
+++ b/src/tools/ifcodegen/deploy-virtualenv-files.txt
@@ -59,6 +59,7 @@ configparser.py
contextlib.py
crypt.py
csv.py
+dataclasses.py
datetime.py
decimal.py
difflib.py
diff --git a/src/tools/ifcodegen/templates/backend_qtro/backend.cpp.tpl b/src/tools/ifcodegen/templates/backend_qtro/backend.cpp.tpl
index 82251027..83605d2e 100644
--- a/src/tools/ifcodegen/templates/backend_qtro/backend.cpp.tpl
+++ b/src/tools/ifcodegen/templates/backend_qtro/backend.cpp.tpl
@@ -85,7 +85,7 @@ void {{zone_class}}::sync()
{% for property in interface.properties %}
{% if not property.type.is_model %}
QRemoteObjectPendingReply<{{property|return_type}}> {{property}}Reply = m_parent->m_replica->{{property|getter_name}}(m_zone);
- auto {{property}}Watcher = new QRemoteObjectPendingCallWatcher({{property}}Reply);
+ auto {{property}}Watcher = new QRemoteObjectPendingCallWatcher({{property}}Reply, this);
connect({{property}}Watcher, &QRemoteObjectPendingCallWatcher::finished, this, [this](QRemoteObjectPendingCallWatcher *self) mutable {
if (self->error() == QRemoteObjectPendingCallWatcher::NoError) {
m_{{property}} = self->returnValue().value<{{property|return_type}}>();
@@ -189,7 +189,7 @@ void {{class}}::syncZones()
if (m_replica.isNull())
return;
QRemoteObjectPendingReply<QStringList> zoneReply = m_replica->availableZones();
- auto zoneWatcher = new QRemoteObjectPendingCallWatcher(zoneReply);
+ auto zoneWatcher = new QRemoteObjectPendingCallWatcher(zoneReply, this);
connect(zoneWatcher, &QRemoteObjectPendingCallWatcher::finished, this, [this, zoneReply](QRemoteObjectPendingCallWatcher *self) mutable {
if (self->error() == QRemoteObjectPendingCallWatcher::NoError) {
if (!m_synced) {
diff --git a/src/tools/ifcodegen/templates/frontend/interface.cpp.tpl b/src/tools/ifcodegen/templates/frontend/interface.cpp.tpl
index 050edc70..b53bec50 100644
--- a/src/tools/ifcodegen/templates/frontend/interface.cpp.tpl
+++ b/src/tools/ifcodegen/templates/frontend/interface.cpp.tpl
@@ -85,6 +85,18 @@ QT_BEGIN_NAMESPACE
{% endif %}
}
+{{class}}Private::~{{class}}Private()
+{
+{% for property in interface.properties %}
+{% if property.type.is_model %}
+ if (m_{{property}}) {
+ delete m_{{property}}->serviceObject();
+ delete m_{{property}};
+ }
+{% endif %}
+{% endfor %}
+}
+
/*! \internal */
{{class}}Private *{{class}}Private::get({{class}} *v)
{
diff --git a/src/tools/ifcodegen/templates/frontend/interface_p.h.tpl b/src/tools/ifcodegen/templates/frontend/interface_p.h.tpl
index be438180..3cfe20f0 100644
--- a/src/tools/ifcodegen/templates/frontend/interface_p.h.tpl
+++ b/src/tools/ifcodegen/templates/frontend/interface_p.h.tpl
@@ -81,6 +81,7 @@ public:
{{class}}Private(const QString &interface, {{class}} *parent);
{% endif %}
{% endif %}
+ ~{{class}}Private();
static {{class}}Private *get({{class}} *p);
static const {{class}}Private *get(const {{class}} *p);
diff --git a/src/tools/ifcodegen/templates/test/tst_test.cpp.tpl b/src/tools/ifcodegen/templates/test/tst_test.cpp.tpl
index 297a9754..2815f3c2 100644
--- a/src/tools/ifcodegen/templates/test/tst_test.cpp.tpl
+++ b/src/tools/ifcodegen/templates/test/tst_test.cpp.tpl
@@ -57,8 +57,8 @@ class {{interface}}TestBackend : public {{interface}}BackendInterface
Q_OBJECT
public:
- {{interface}}TestBackend()
- : {{interface}}BackendInterface()
+ {{interface}}TestBackend(QObject *parent = nullptr)
+ : {{interface}}BackendInterface(parent)
{% for property in interface.properties %}
{% if property.type.is_model %}
{% if interface_zoned %}
@@ -190,7 +190,7 @@ public:
explicit {{interface}}TestServiceObject(QObject *parent=nullptr) :
QIfServiceObject(parent), m_name(QLatin1String(""))
{
- m_backend = new {{interface}}TestBackend;
+ m_backend = new {{interface}}TestBackend(this);
m_interfaces << {{module.module_name|upperfirst}}_{{interface}}_iid;
}
diff --git a/tests/auto/core/qifabstractfeature/tst_qifabstractfeature.cpp b/tests/auto/core/qifabstractfeature/tst_qifabstractfeature.cpp
index fc9171f5..2ea0fdc8 100644
--- a/tests/auto/core/qifabstractfeature/tst_qifabstractfeature.cpp
+++ b/tests/auto/core/qifabstractfeature/tst_qifabstractfeature.cpp
@@ -243,9 +243,9 @@ private:
QIfFeatureTester *createTester(bool testBaseFunctions = false)
{
if (m_isModel)
- return new QIfFeatureTester(new TestFeatureListModel(testBaseFunctions));
+ return new QIfFeatureTester(new TestFeatureListModel(testBaseFunctions, this), this);
else
- return new QIfFeatureTester(new TestFeature(testBaseFunctions));
+ return new QIfFeatureTester(new TestFeature(testBaseFunctions, this), this);
}
QIfServiceManager *m_manager;
@@ -409,9 +409,9 @@ void BaseTest::testAutoDiscovery_qml()
QVERIFY2(obj, qPrintable(component.errorString()));
QIfFeatureTester *defaultItem;
if (m_isModel)
- defaultItem = new QIfFeatureTester(obj->findChild<TestFeatureListModel*>("default"));
+ defaultItem = new QIfFeatureTester(obj->findChild<TestFeatureListModel*>("default"), this);
else
- defaultItem = new QIfFeatureTester(obj->findChild<TestFeature*>("default"));
+ defaultItem = new QIfFeatureTester(obj->findChild<TestFeature*>("default"), this);
QVERIFY(defaultItem);
QCOMPARE(defaultItem->discoveryMode(), QIfAbstractFeature::AutoDiscovery);
QVERIFY(defaultItem->serviceObject());
@@ -419,9 +419,9 @@ void BaseTest::testAutoDiscovery_qml()
QIfFeatureTester *autoDiscoveryDisabledItem;
if (m_isModel)
- autoDiscoveryDisabledItem = new QIfFeatureTester(obj->findChild<TestFeatureListModel*>("autoDiscoveryDisabled"));
+ autoDiscoveryDisabledItem = new QIfFeatureTester(obj->findChild<TestFeatureListModel*>("autoDiscoveryDisabled"), this);
else
- autoDiscoveryDisabledItem = new QIfFeatureTester(obj->findChild<TestFeature*>("autoDiscoveryDisabled"));
+ autoDiscoveryDisabledItem = new QIfFeatureTester(obj->findChild<TestFeature*>("autoDiscoveryDisabled"), this);
QVERIFY(autoDiscoveryDisabledItem);
QSignalSpy autoDiscoveryChanged(autoDiscoveryDisabledItem, &QIfFeatureTester::discoveryModeChanged);
QSignalSpy serviceObjectChangedSpy(autoDiscoveryDisabledItem, &QIfFeatureTester::serviceObjectChanged);
@@ -436,6 +436,7 @@ void BaseTest::testAutoDiscovery_qml()
delete defaultItem;
delete autoDiscoveryDisabledItem;
+ delete obj;
}
void BaseTest::testProxyServiceObject()
diff --git a/tests/auto/core/qiffilterandbrowsemodel/tst_qiffilterandbrowsemodel.cpp b/tests/auto/core/qiffilterandbrowsemodel/tst_qiffilterandbrowsemodel.cpp
index 271b40d8..17e32dd7 100644
--- a/tests/auto/core/qiffilterandbrowsemodel/tst_qiffilterandbrowsemodel.cpp
+++ b/tests/auto/core/qiffilterandbrowsemodel/tst_qiffilterandbrowsemodel.cpp
@@ -377,6 +377,7 @@ public:
QIfServiceObject(parent)
{
m_backend = new TestBackend;
+ m_backend->setParent(this);
m_interfaces << QIfFilterAndBrowseModel_iid;
}
diff --git a/tests/auto/core/qifpagingmodel/tst_qifpagingmodel.cpp b/tests/auto/core/qifpagingmodel/tst_qifpagingmodel.cpp
index 2de3991f..7d2c8c69 100644
--- a/tests/auto/core/qifpagingmodel/tst_qifpagingmodel.cpp
+++ b/tests/auto/core/qifpagingmodel/tst_qifpagingmodel.cpp
@@ -154,6 +154,7 @@ public:
QIfServiceObject(parent)
{
m_backend = new TestBackend;
+ m_backend->setParent(this);
m_interfaces << QIfPagingModel_iid;
}
diff --git a/tests/auto/core/qifpendingreply/tst_qifpendingreply.cpp b/tests/auto/core/qifpendingreply/tst_qifpendingreply.cpp
index a97b5a3e..3120aa42 100644
--- a/tests/auto/core/qifpendingreply/tst_qifpendingreply.cpp
+++ b/tests/auto/core/qifpendingreply/tst_qifpendingreply.cpp
@@ -39,7 +39,7 @@
#define TEST_FUNCTION(NAME, TYPE) QIfPendingReply<TYPE> TestObject::test_##NAME(TYPE result, bool fail) { \
QIfPendingReply<TYPE> reply; \
- auto timer = new QTimer(); \
+ auto timer = new QTimer(this); \
timer->setSingleShot(true); \
connect(timer, &QTimer::timeout, this, [reply, fail, result]() mutable { \
if (fail) \
@@ -115,7 +115,7 @@ Q_DECLARE_METATYPE(TestGadget)
QIfPendingReply<void> TestObject::test_void(bool fail) {
QIfPendingReply<void> reply;
- auto timer = new QTimer();
+ auto timer = new QTimer(this);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, [reply, fail]() mutable {
if (fail)