diff options
| author | BogDan Vatra <bogdan.vatra.ford@kdab.com> | 2016-07-29 11:52:22 +0300 |
|---|---|---|
| committer | BogDan Vatra <bogdan@kdab.com> | 2016-09-08 14:44:40 +0000 |
| commit | c14a857ddb7f53e1cf8bbcc28ad7b1b9ca5db8cc (patch) | |
| tree | 50d4d9118ef79ca1beea3bcfd518236c9bca0ae2 /src/remoteobjects/qremoteobjectsource.cpp | |
| parent | 18cdd36ab105b0a1b375563812be2b1b08f9f666 (diff) | |
Generate, send and check class signature for .rep generated classes
If the signature mismatch it will not complete the connection and will
signal the error.
Change-Id: Idd4a7a5290bb60d7428e16047a1b82db5e52b372
Reviewed-by: Continuous Integration (KDAB) <build@kdab.com>
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Diffstat (limited to 'src/remoteobjects/qremoteobjectsource.cpp')
| -rw-r--r-- | src/remoteobjects/qremoteobjectsource.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/remoteobjects/qremoteobjectsource.cpp b/src/remoteobjects/qremoteobjectsource.cpp index 4f7e326..d953470 100644 --- a/src/remoteobjects/qremoteobjectsource.cpp +++ b/src/remoteobjects/qremoteobjectsource.cpp @@ -57,6 +57,21 @@ using namespace QRemoteObjectPackets; const int QRemoteObjectSource::qobjectPropertyOffset = QObject::staticMetaObject.propertyCount(); const int QRemoteObjectSource::qobjectMethodOffset = QObject::staticMetaObject.methodCount(); +static const QByteArray s_classinfoRemoteobjectSignature(QCLASSINFO_REMOTEOBJECT_SIGNATURE); + + +QByteArray qtro_classinfo_signature(const QMetaObject *metaObject) +{ + if (!metaObject) + return QByteArray{}; + + for (int i = metaObject->classInfoOffset(); i < metaObject->classInfoCount(); ++i) { + auto ci = metaObject->classInfo(i); + if (s_classinfoRemoteobjectSignature == ci.name()) + return ci.value(); + } + return QByteArray{}; +} QRemoteObjectSource::QRemoteObjectSource(QObject *obj, const SourceApiMap *api, QObject *adapter, QRemoteObjectSourceIo *sourceIo) @@ -261,6 +276,8 @@ DynamicApiMap::DynamicApiMap(const QMetaObject *metaObject, const QString &name, } else if (m == QMetaMethod::Slot || m == QMetaMethod::Method) m_methods << i; } + + m_objectSignature = qtro_classinfo_signature(metaObject); } int DynamicApiMap::parameterCount(int objectIndex) const |
