summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusmetaobject.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-01-29 12:35:43 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-31 00:15:51 +0100
commit15f8bc1f6ee94b84bebbd06de9db3ceacecad24d (patch)
tree0d802426611cb77630fa043bf45a9b0ebfc45806 /src/dbus/qdbusmetaobject.cpp
parentcc8e0d85e26f699ffa1e5eec3db9897a8bd417ff (diff)
Also register complex D-Bus types when running under qdbus
When running inside qdbus, we generate the meta objects a little differently. Previously, for unknown types we'd simply have a -1 as the type ID in the meta object, but this doesn't work in Qt 5 (has apparently never worked). So simply register a type with the metatype system and let QMetaObject do its thing. [ChangeLog][qdbus]Fixed a bug that caused the qdbus tool to crash when trying to display remote interfaces that had complex types without a matching base Qt type. Task-number: QTBUG-36524 Change-Id: Ifef65b340dc89d3295ed6ef00f2dcc60849ecb02 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'src/dbus/qdbusmetaobject.cpp')
-rw-r--r--src/dbus/qdbusmetaobject.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp
index 13c538bb59..392eac6081 100644
--- a/src/dbus/qdbusmetaobject.cpp
+++ b/src/dbus/qdbusmetaobject.cpp
@@ -128,12 +128,7 @@ QDBusMetaObjectGenerator::QDBusMetaObjectGenerator(const QString &interfaceName,
}
}
-Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false;
-
-QDBusMetaObjectGenerator::Type
-QDBusMetaObjectGenerator::findType(const QByteArray &signature,
- const QDBusIntrospection::Annotations &annotations,
- const char *direction, int id)
+static int registerComplexDBusType(const char *typeName)
{
struct QDBusRawTypeHandler {
static void destroy(void *)
@@ -159,6 +154,22 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
}
};
+ return QMetaType::registerNormalizedType(typeName, QDBusRawTypeHandler::destroy,
+ QDBusRawTypeHandler::create,
+ QDBusRawTypeHandler::destruct,
+ QDBusRawTypeHandler::construct,
+ sizeof(void *),
+ QMetaType::MovableType,
+ 0);
+}
+
+Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false;
+
+QDBusMetaObjectGenerator::Type
+QDBusMetaObjectGenerator::findType(const QByteArray &signature,
+ const QDBusIntrospection::Annotations &annotations,
+ const char *direction, int id)
+{
Type result;
result.id = QVariant::Invalid;
@@ -195,13 +206,7 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
// type is still unknown or doesn't match back to the signature that it
// was expected to, so synthesize a fake type
typeName = "QDBusRawType<0x" + signature.toHex() + ">*";
- type = QMetaType::registerType(typeName, QDBusRawTypeHandler::destroy,
- QDBusRawTypeHandler::create,
- QDBusRawTypeHandler::destruct,
- QDBusRawTypeHandler::construct,
- sizeof(void *),
- QMetaType::MovableType,
- 0);
+ type = registerComplexDBusType(typeName);
}
result.name = typeName;
@@ -217,7 +222,7 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
type = QVariant::Map;
} else {
result.name = "QDBusRawType::" + signature;
- type = -1;
+ type = registerComplexDBusType(result.name);
}
} else {
result.name = QMetaType::typeName(type);