Commit 7f270efe authored by David Edmundson's avatar David Edmundson

Register objectPath before service

When the service is regsitered we want to have all the internal routing
pre-configured. Otherwise pending calls (such as pending DBus activated
calls) can be processed before the path is registered and then fail with
an error that the path does not exist.

Also remove the fairly redundant check on registerObject. That can return
false if some object in this process has registered itself on that path; but in that
case, the very last thing we'd want to do is call unregisterService.

Test Plan:
Generated a load of notifications
Started plasma
Ouptut showed valid return on GetCapabilities, not an error on missing path

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent f37c1767
......@@ -95,15 +95,10 @@ void NotificationsEngine::init()
bool NotificationsEngine::registerDBusService()
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject(QStringLiteral("/org/freedesktop/Notifications"), this);
bool so = dbus.registerService(QStringLiteral("org.freedesktop.Notifications"));
if (so) {
bool ro = dbus.registerObject(QStringLiteral("/org/freedesktop/Notifications"), this);
if (ro) {
qDebug() << "Notifications service registered";
return true;
} else {
return true;
qDebug() << "Failed to register Notifications service";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment