How to chek the presence of an object on dbus

Thiago Macieira thiago at
Mon Aug 30 23:01:53 PDT 2010

On Tuesday 31. August 2010 07.32.07 Rémi Denis-Courmont wrote:
> Le mardi 31 août 2010, tomw a écrit :
> > I was wondering how to check the presence of an object on the dbus
> > the most elegant way. Of course, one could create a proxy object on
> > the path and call the Introspect method. If this returns proper
> > introspect data the object is available. However, are there any
> > better ways?
> Objects are not present "on the bus". They are instantiated in ways
> specific to DBus client process, or at least its DBus implementation.
> Not all DBus clients implement introspection. And even when they do
> implement it (correctly), there is no race-free nor poll-free way to be
> notified of objects tree changes.
> In my opinion, the most "elegant" way to check that an object exists is
> to query it. This is interface-specific, but you should know what you
> are talking with anyway.

Rémi is correct.

The most elegant way to check if an object exists is to use it as if it 
existed. If it exists, your operation will work. If it doesn't exist, you'll 
get an error indicating that it doesn't.

Thiago Macieira - thiago (AT) - thiago (AT)
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the dbus mailing list