diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-09-10 15:07:29 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-09-22 13:13:16 (GMT) |
commit | ad1fe7574f36dc54a1a0050308c52fc15e757842 (patch) | |
tree | a0970ae583efedbc8883b93aac7fabb2b48f70d2 /src | |
parent | 56bb732f1628fb23b98a2554348b309f634ca55f (diff) | |
download | Qt-ad1fe7574f36dc54a1a0050308c52fc15e757842.zip Qt-ad1fe7574f36dc54a1a0050308c52fc15e757842.tar.gz Qt-ad1fe7574f36dc54a1a0050308c52fc15e757842.tar.bz2 |
Pre-populate the watched services hash with org.freedesktop.DBus
The D-Bus specification doesn't require
GetNameOwner("org.freedesktop.DBus") to return anything in specific,
but the reference implementation always returns
"org.freedesktop.DBus". The Python D-Bus bindings even require it.
So add the same assumption to QtDBus, which saves a round-trip at the
application start to ask the server what its own owner is
Reviewed-By: Robin Burchell
Reviewed-By: Ritt Konstantin
Diffstat (limited to 'src')
-rw-r--r-- | src/dbus/qdbusconnection_p.h | 3 | ||||
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 81af2c7..1bd00da 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -160,6 +160,9 @@ public: struct WatchedServiceData { WatchedServiceData() : refcount(0) {} + WatchedServiceData(const QString &owner, int refcount = 0) + : owner(owner), refcount(refcount) + {} QString owner; int refcount; }; diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index cf6ca28..c7b531e 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -973,6 +973,10 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) QDBusMetaTypeId::init(); rootNode.flags = 0; + + // prepopulate watchedServices: + // we know that the owner of org.freedesktop.DBus is itself + watchedServices.insert(dbusServiceString(), WatchedServiceData(dbusServiceString(), 1)); } QDBusConnectionPrivate::~QDBusConnectionPrivate() |