Revert "fix: core dumped under Qt 6.4"
Github bug makes me commit wrong content, revert it.
This reverts commit 6fae5a758b
.
This commit is contained in:
parent
6fae5a758b
commit
25a7acb6fd
@ -26,7 +26,6 @@ void registerComplexDbusType()
|
|||||||
qDBusRegisterMetaType<QMap<QString, QString>>();
|
qDBusRegisterMetaType<QMap<QString, QString>>();
|
||||||
qRegisterMetaType<PropMap>();
|
qRegisterMetaType<PropMap>();
|
||||||
qDBusRegisterMetaType<PropMap>();
|
qDBusRegisterMetaType<PropMap>();
|
||||||
qDBusRegisterMetaType<QDBusObjectPath>();
|
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -35,11 +35,4 @@ constexpr auto ApplicationManagerDestDBusName =
|
|||||||
u8"deepin_application_manager_dest_bus";
|
u8"deepin_application_manager_dest_bus";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr auto ObjectManagerInterface = "org.desktopspec.DBus.ObjectManager";
|
|
||||||
constexpr auto JobManagerInterface = "org.desktopspec.JobManager1";
|
|
||||||
constexpr auto JobInterface = "org.desktopspec.JobManager1.Job";
|
|
||||||
constexpr auto ApplicationManagerInterface = "org.desktopspec.ApplicationManager1";
|
|
||||||
constexpr auto InstanceInterface = "org.desktopspec.ApplicationManager1.Instance";
|
|
||||||
constexpr auto ApplicationInterface = "org.desktopspec.ApplicationManager1.Application";
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,8 @@ ApplicationManager1Service::ApplicationManager1Service(std::unique_ptr<Identifie
|
|||||||
std::terminate();
|
std::terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!registerObjectToDBus(this, DDEApplicationManager1ObjectPath, ApplicationManagerInterface)) {
|
if (!registerObjectToDBus(
|
||||||
|
this, DDEApplicationManager1ObjectPath, getDBusInterface(QMetaType::fromType<ApplicationManager1Adaptor>()))) {
|
||||||
std::terminate();
|
std::terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +130,8 @@ bool ApplicationManager1Service::addApplication(DesktopFile desktopFileSource) n
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!registerObjectToDBus(ptr, application->applicationPath().path(), ApplicationInterface)) {
|
if (!registerObjectToDBus(
|
||||||
|
ptr, application->applicationPath().path(), getDBusInterface(QMetaType::fromType<ApplicationAdaptor>()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_applicationList.insert(application->applicationPath(), application);
|
m_applicationList.insert(application->applicationPath(), application);
|
||||||
|
@ -317,7 +317,7 @@ bool ApplicationService::addOneInstance(const QString &instanceId, const QString
|
|||||||
auto *adaptor = new InstanceAdaptor(service);
|
auto *adaptor = new InstanceAdaptor(service);
|
||||||
QString objectPath{m_applicationPath.path() + "/" + instanceId};
|
QString objectPath{m_applicationPath.path() + "/" + instanceId};
|
||||||
|
|
||||||
if (registerObjectToDBus(service, objectPath, InstanceInterface)) {
|
if (registerObjectToDBus(service, objectPath, getDBusInterface(QMetaType::fromType<InstanceAdaptor>()))) {
|
||||||
m_Instances.insert(QDBusObjectPath{objectPath}, QSharedPointer<InstanceService>{service});
|
m_Instances.insert(QDBusObjectPath{objectPath}, QSharedPointer<InstanceService>{service});
|
||||||
service->moveToThread(this->thread());
|
service->moveToThread(this->thread());
|
||||||
adaptor->moveToThread(this->thread());
|
adaptor->moveToThread(this->thread());
|
||||||
|
@ -9,7 +9,8 @@ JobManager1Service::JobManager1Service(ApplicationManager1Service *parent)
|
|||||||
: m_parent(parent)
|
: m_parent(parent)
|
||||||
{
|
{
|
||||||
new JobManager1Adaptor{this};
|
new JobManager1Adaptor{this};
|
||||||
if (!registerObjectToDBus(this, DDEApplicationManager1JobManagerObjectPath, JobManagerInterface)) {
|
if (!registerObjectToDBus(
|
||||||
|
this, DDEApplicationManager1JobManagerObjectPath, getDBusInterface(QMetaType::fromType<JobManager1Adaptor>()))) {
|
||||||
std::terminate();
|
std::terminate();
|
||||||
}
|
}
|
||||||
qRegisterMetaType<LaunchTask>();
|
qRegisterMetaType<LaunchTask>();
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
|
|
||||||
auto *ptr = job.data();
|
auto *ptr = job.data();
|
||||||
new JobAdaptor(ptr);
|
new JobAdaptor(ptr);
|
||||||
if (!registerObjectToDBus(ptr, objectPath, JobInterface)) {
|
if (!registerObjectToDBus(ptr, objectPath, getDBusInterface(QMetaType::fromType<JobAdaptor>()))) {
|
||||||
qCritical() << "can't register job to dbus.";
|
qCritical() << "can't register job to dbus.";
|
||||||
future.cancel();
|
future.cancel();
|
||||||
return {};
|
return {};
|
||||||
|
22
src/global.h
22
src/global.h
@ -196,24 +196,12 @@ void unregisterObjectFromDBus(const QString &path);
|
|||||||
|
|
||||||
inline QString getDBusInterface(const QMetaType &meta)
|
inline QString getDBusInterface(const QMetaType &meta)
|
||||||
{
|
{
|
||||||
auto name = QString{meta.name()};
|
const auto *infoObject = meta.metaObject();
|
||||||
if (name == "ApplicationAdaptor") {
|
if (auto infoIndex = infoObject->indexOfClassInfo("D-Bus Interface"); infoIndex != -1) {
|
||||||
return ApplicationInterface;
|
return infoObject->classInfo(infoIndex).value();
|
||||||
}
|
}
|
||||||
|
qWarning() << "no interface found.";
|
||||||
if (name == "InstanceAdaptor") {
|
return {};
|
||||||
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)
|
inline ObjectInterfaceMap getChildInterfacesAndPropertiesFromObject(QObject *o)
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#define SYSTEMDSIGNALDISPATCHER_H
|
#define SYSTEMDSIGNALDISPATCHER_H
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include <QDBusMessage>
|
|
||||||
|
|
||||||
class SystemdSignalDispatcher : public QObject
|
class SystemdSignalDispatcher : public QObject
|
||||||
{
|
{
|
||||||
@ -30,13 +29,8 @@ private:
|
|||||||
explicit SystemdSignalDispatcher(QObject *parent = nullptr)
|
explicit SystemdSignalDispatcher(QObject *parent = nullptr)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
auto &con = ApplicationManager1DBus::instance().globalDestBus();
|
|
||||||
auto ret = con.call(QDBusMessage::createMethodCall(SystemdService, SystemdObjectPath, SystemdInterfaceName, "Subscribe"));
|
|
||||||
if (ret.type() == QDBusMessage::ErrorMessage) {
|
|
||||||
qFatal("%s", ret.errorMessage().toLocal8Bit().data());
|
|
||||||
}
|
|
||||||
if (!connectToSignals()) {
|
if (!connectToSignals()) {
|
||||||
qCritical() << "couldn't connect to Systemd signals";
|
std::terminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool connectToSignals() noexcept;
|
bool connectToSignals() noexcept;
|
||||||
|
Loading…
Reference in New Issue
Block a user