Search code examples
pythonobjectlifecycledbus

DBus object lifecycle


I'm creating a python service that will receive dbus messages, create Job objects and return those objects to the calling application. The calling application will then use this Job object to receive signals from it ( when it has found something or finished working for example ).

Everything is working, I just need to know how to remove those objects from the dbus after they aren't needed anymore. In the dbus-python documentation (http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html#exporting-objects) it shows how to export an object, but not how to remove it from the bus.


Solution

  • I found out that the way to remove the object from the bus is just to call: object.remove_from_connection()

    The remove_from_connection is inherited from dbus.service.Object which is the superclass for all dbus objects in python