DBus Object Paths and Refcounting

Ryan Lortie desrt at desrt.ca
Sat Aug 11 10:09:57 PDT 2007


You have an application written in some suitably high-level language
(like GObject :) ) and you put some objects on the bus.

register (object, "/some/path")

Some method call in your app returns an object path "/some/path" in
response to some call.

The client receives this message and "dereferences" the object by
performing some method calls against it.

...but in the meantime...

the object has disappeared from your program by whatever means.  Uh oh.




Just a random idea I had a little while ago that might be a neat feature
to implement for high-level language bindings:  When sending an object
path, the receiving application now implicitly owns a reference on that
object.



When sending, the refcount on the native object would be incremented.
In addition to this, the high-level bindings would keep track of which
clients own how many references on each object.

There would also have to be some sort of 'org.freedesktop.DBus.Unref'
call (which checks that a given client doesn't unref too many things).

If a client randomly leaves the bus, all of its references drop.

Not sure how to handle broadcast messages containing references.



This would be really really cool, but maybe it's just completely
unimplementable.  To be quite honest, I haven't thought too much about
it :)

Any comments?

Cheers



More information about the dbus mailing list