fix: core dumped under Qt 6.4

call method metaObject of QMetaType will coredump under Qt 6.4

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe
2023-08-28 11:11:50 +08:00
committed by black-desk
parent 25a7acb6fd
commit 8a662314f2
7 changed files with 30 additions and 13 deletions

View File

@ -196,12 +196,24 @@ void unregisterObjectFromDBus(const QString &path);
inline QString getDBusInterface(const QMetaType &meta)
{
const auto *infoObject = meta.metaObject();
if (auto infoIndex = infoObject->indexOfClassInfo("D-Bus Interface"); infoIndex != -1) {
return infoObject->classInfo(infoIndex).value();
auto name = QString{meta.name()};
if (name == "ApplicationAdaptor") {
return ApplicationInterface;
}
qWarning() << "no interface found.";
return {};
if (name == "InstanceAdaptor") {
return InstanceInterface;
}
if (name == "APPObjectManagerAdaptor" or name == "AMObjectManagerAdaptor") {
return ObjectManagerInterface;
}
// const auto *infoObject = meta.metaObject();
// if (auto infoIndex = infoObject->indexOfClassInfo("D-Bus Interface"); infoIndex != -1) {
// return infoObject->classInfo(infoIndex).value();
// }
qWarning() << "couldn't found interface:" << name;
return "";
}
inline ObjectInterfaceMap getChildInterfacesAndPropertiesFromObject(QObject *o)