D-Bus Activation Problem...
Simon McVittie
simon.mcvittie at collabora.co.uk
Fri Apr 25 03:43:38 PDT 2008
On Fri, 25 Apr 2008 at 03:34:49 +0300, S.Çağlar Onur wrote:
> We are writing a PolicyKit-KDE [1] interface for KDE3 using Qt3 backport of the Qt4 bindings [2]. If policykit-kde started directly from console everything works as expected without a problem, when it's started with dbus service activation __first call__ always ends up with "org.freedesktop.DBus.Error.NoReply" but subsequent calls works fine like following;
You've probably implemented it subtly wrong. The correct sequence for an
activatable service is:
* set up whatever object paths are guaranteed to exist at startup for the
service you're implementing
* *then and only then*, request your well-known bus name ("service name")
Starting from the moment when you're given the well-known name, clients
can call your methods (and if you were activated by a method call, that
method call will almost certainly be the next thing off your incoming message
queue). A lot of people get this wrong.
The particularly tricky bit is that if you do it in the wrong order, it
sometimes works! If you do this, it's wrong but it works:
* request your well-known bus name
* do some other stuff that *does not* re-enter the main loop or otherwise
cause D-Bus messages on the incoming queue to be processed
* set up your objects
but with this small change it will break:
* request your well-known bus name
* do some other stuff that *does* re-enter the main loop or otherwise
cause D-Bus messages on the incoming queue to be processed
* set up your objects
More information about the dbus
mailing list