How to know when D-Bus interfaces and methods are available

David Jarvie djarvie at
Wed Aug 5 09:25:12 BST 2009

On Wed, August 5, 2009 7:31 am, Thiago Macieira wrote:
> David Jarvie wrote:
>>There has been some discussion on the kde-pim list about how to
>> successfully call D-Bus methods immediately after starting an
>> application. The problem is that initially, only the D-Bus service for
>> the application exists, and it is necessary to wait until first its
>> interfaces and then its methods are ready to be used. Unfortunately
>> there seems to be no clean way to know when the D-Bus methods are ready
>> to be called.
>>As pointed out by Ingo Klöcker, this is likely to be a problem
>> encountered by others, so I'm forwarding the discussion to core-devel.
> The solution is simple:
> Don't register the service name until your objects are set up. Or, at the
> latest, make sure that they will be created before the next event loop
> run.
> That's Thomas's solution. It's the correct way to go.

If my understanding is correct, KApplication automatically registers a
D-Bus service for the application in its constructor. Following your
advice, that would imply that applications can't use their default D-Bus
service for a callable interface, but must instead set up an additional
service which they would register later. That might be practical for
objects/methods which the application explicitly creates, but what about
default ones like com.trolltech.Qt.QWidget?

David Jarvie.
KDE developer.
KAlarm author & maintainer.

More information about the kde-core-devel mailing list