DBus GObject & g_object_unref

Havoc Pennington hp at redhat.com
Mon Jul 31 12:14:12 PDT 2006



Marc-André Lureau wrote:
> My issue is not solved, unfortunately.
> 
> I don't know how to do, it's been a while I am trying to do that:
> http://pastebin.ca/108858
> 
> Basically, I have a proxy_for_name_owner, and I would like to
> be notified when the service-object is unref or when the service
> is released.
> 
> If it's not possible, I will add a "disconnect" signal to my
> service... but I guess it's bad,... and unnecessary.
> 
> My understanding is that the ":1.xx" is still there after the unref,
> and that's why the proxy is not notified.
> 
> Should I listen to NameOwnerChange instead ?
> 

unref() does not cause the name owner to change or your remote process 
to exit. The reference count is purely _on the proxy_ - there's no 
reference count on a remote process.

You should get a destroy signal if your proxy exists and the remote 
process exits - this is already done by listening for NameOwnerChanged, 
so you need not listen for NameOwnerChanged manually.

There's no standard dbus way for the remote process to exit, because how 
this should work depends very much on the specific application. Some 
remote processes never exit; some exit when they lose a particular bus 
name; some exit after a timeout; some have their clients register and 
then exit when the clients have all unregistered.

Havoc



More information about the dbus mailing list