telepathy-qt: Register object before the service gets exposed on DBus
Alexandr Akulich
kaffeine at kemper.freedesktop.org
Wed May 2 17:52:29 UTC 2018
Module: telepathy-qt
Branch: master
Commit: f81ae2d33ff36baa7938b4f89fa51372c9ff1fcc
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=f81ae2d33ff36baa7938b4f89fa51372c9ff1fcc
Author: Gustavo Pichorim Boiko <gustavo.boiko at canonical.com>
Date: Tue Nov 22 14:37:37 2016 -0200
Register object before the service gets exposed on DBus
Reviewed-by: Alexandr Akulich <akulichalexander at gmail.com>
---
TelepathyQt/dbus-service.cpp | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/TelepathyQt/dbus-service.cpp b/TelepathyQt/dbus-service.cpp
index c6dcab84..fa393635 100644
--- a/TelepathyQt/dbus-service.cpp
+++ b/TelepathyQt/dbus-service.cpp
@@ -164,15 +164,6 @@ bool DBusService::registerObject(const QString &busName, const QString &objectPa
return true;
}
- if (!mPriv->dbusObject->dbusConnection().registerService(busName)) {
- error->set(TP_QT_ERROR_INVALID_ARGUMENT,
- QString(QLatin1String("Name %1 already in use by another process"))
- .arg(busName));
- warning() << "Unable to register service" << busName <<
- "- name already registered by another process";
- return false;
- }
-
if (!mPriv->dbusObject->dbusConnection().registerObject(objectPath, mPriv->dbusObject)) {
error->set(TP_QT_ERROR_INVALID_ARGUMENT,
QString(QLatin1String("Object at path %1 already registered"))
@@ -182,6 +173,16 @@ bool DBusService::registerObject(const QString &busName, const QString &objectPa
return false;
}
+ if (!mPriv->dbusObject->dbusConnection().registerService(busName)) {
+ mPriv->dbusObject->dbusConnection().unregisterObject(objectPath);
+ error->set(TP_QT_ERROR_INVALID_ARGUMENT,
+ QString(QLatin1String("Name %1 already in use by another process"))
+ .arg(busName));
+ warning() << "Unable to register service" << busName <<
+ "- name already registered by another process";
+ return false;
+ }
+
debug() << "Registered object" << objectPath << "at bus name" << busName;
mPriv->busName = busName;
More information about the telepathy-commits
mailing list