Fwd: How to (correctly) signal that a DBusObject was removed?
Nicolas SCHOEMAEKER
ns.schoe at gmail.com
Tue May 9 08:11:33 UTC 2017
Hi everyone,
today I am wondering about the standard interface
'org.freedesktop.DBus.ObjectManager', and especially the
'InterfacesRemoved' signal.
As per the documentation
(https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager),
it is said "The |InterfacesRemoved| signal is emitted whenever an object
is removed or it loses one or more interfaces.".
I understand that if object '/path/to/obj' loses its interfaces
'org.iface.one' and 'org.iface.two' then the first argument of the
signal is the object path '/path/to/obj' and the second interface is an
array of the two lost interfaces, so ['org.iface.one', 'org.iface.two'].
What I'm not sure is when object at '/path/to/obj' is removed. A trivial
example is if I have a phone book application which creates contacts at
'/com/test/PhoneBook/Contacts/1', '/com/test/PhoneBook/Contacts/2', etc.
and one contact is removed. This contacts (or more generally the removed
object path) might implement several interfaces, and my question today
is: should I emit the signal with all of the object's interfaces in the
second argument, OR should I emit the signal with the second argument
empty (thus "empty" being a special case to signal that the entire
object path is removed)?
I can't find any documentation on this, and since I am writing a
binding, it's important that I get this right. My instincts tells me the
latter is the best, because I can see several disadvantages to the former:
- you have to do extra-work at the moment you delete the object path:
you need to list the interfaces and send them
- it makes more data to transmit
- the receiver must also make extra work: removing all interfaces, and
checking if the object path has any interfaces left, if no, delete it
- I can totally see a problem with this when the receiver and the sender
are not synced and at the moment the signal is received, the list of
interfaces are not the same on both sides.
So while waiting for your answer, I have implemented the latter method:
whenever an object path is removed, I send an empty array which is a
clear signal to delete the whole object path.
Can you confirm?
Thanks in advance,
cheers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20170509/736bfce4/attachment.html>
More information about the dbus
mailing list