Destruction Model for Ardour developers

An image of how destruction occurs in the ardour source code

Notes

  • Session is the owner of Route (and others), so it is asked to take care of the deletion
  • Deletion starts with drop_references(), and once this process is complete, the reference count
    for the object should drop to zero, resulting in the actual destructor being called
  • DropReferences is a signal for libardour (and related) objects
  • CatchDeletion is a signal for UI (and related) objects
  • It is not possible to predict which thread the destructor will be called in
  • Each UI event loop that holds references to a Route (or similar) must connect to its DropReferences
    signal. Its handler for that signal must (a) drop any reference to the route (by resetting or
    deleting shared pointers that point at the object) (b) delete any GUI objects that provide
    View or Control of the object. The objects should emit CatchDeletion to allow their parents/owners
    (the editor or mixer, for example) to notice what has happened and act appropriately.
  • GUI parents/owners should not attempt to connect directly to libardour object signals for
    destruction, but should rely on signals from their children/contents to detect destruction