summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ivicore/qiviabstractfeature.cpp9
-rw-r--r--src/ivicore/qiviabstractfeature_p.h1
-rw-r--r--src/tools/ivigenerator/templates_test/tst_test.cpp.tpl1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/ivicore/qiviabstractfeature.cpp b/src/ivicore/qiviabstractfeature.cpp
index 6022c22..1ed4563 100644
--- a/src/ivicore/qiviabstractfeature.cpp
+++ b/src/ivicore/qiviabstractfeature.cpp
@@ -62,6 +62,7 @@ QIviAbstractFeaturePrivate::QIviAbstractFeaturePrivate(const QString &interface,
, m_error(QIviAbstractFeature::NoError)
, m_qmlCreation(false)
, m_isInitialized(false)
+ , m_isConnected(false)
, m_supportsPropertyOverriding(false)
, m_propertyOverride(nullptr)
{
@@ -299,6 +300,8 @@ bool QIviAbstractFeature::setServiceObject(QIviServiceObject *so)
if (so) {
connectToServiceObject(d->m_serviceObject);
+ if (!d->m_isConnected)
+ qWarning("The QIviServiceObject got accepted but QIviAbstractFeature::connectToServiceObject wasn't called");
connect(so, SIGNAL(destroyed()), this, SLOT(serviceObjectDestroyed()));
}
@@ -655,6 +658,8 @@ void QIviAbstractFeature::connectToServiceObject(QIviServiceObject *serviceObjec
d, &QIviAbstractFeaturePrivate::onInitializationDone);
backend->initialize();
}
+
+ d->m_isConnected = true;
}
/*!
@@ -671,11 +676,15 @@ void QIviAbstractFeature::connectToServiceObject(QIviServiceObject *serviceObjec
*/
void QIviAbstractFeature::disconnectFromServiceObject(QIviServiceObject *serviceObject)
{
+ Q_D(QIviAbstractFeature);
Q_ASSERT(serviceObject);
QObject *backend = serviceObject->interfaceInstance(interfaceName());
if (backend)
disconnect(backend, 0, this, 0);
+
+ d->m_isInitialized = false;
+ d->m_isConnected = false;
}
/*!
diff --git a/src/ivicore/qiviabstractfeature_p.h b/src/ivicore/qiviabstractfeature_p.h
index 19a7490..01f3093 100644
--- a/src/ivicore/qiviabstractfeature_p.h
+++ b/src/ivicore/qiviabstractfeature_p.h
@@ -96,6 +96,7 @@ public:
QIviAbstractFeature::Error m_error;
bool m_qmlCreation;
bool m_isInitialized;
+ bool m_isConnected;
bool m_supportsPropertyOverriding;
QIviPropertyOverrider *m_propertyOverride;
diff --git a/src/tools/ivigenerator/templates_test/tst_test.cpp.tpl b/src/tools/ivigenerator/templates_test/tst_test.cpp.tpl
index 0975017..94778a4 100644
--- a/src/tools/ivigenerator/templates_test/tst_test.cpp.tpl
+++ b/src/tools/ivigenerator/templates_test/tst_test.cpp.tpl
@@ -291,6 +291,7 @@ void {{interface}}Test::testInvalidBackend()
{{interface}}InvalidServiceObject *service = new {{interface}}InvalidServiceObject();
manager->registerService(service, service->interfaces());
{{interface}} cc;
+ QTest::ignoreMessage(QtWarningMsg, "The QIviServiceObject got accepted but QIviAbstractFeature::connectToServiceObject wasn't called");
cc.startAutoDiscovery();
// Running without a backend means that changes do not propagate