mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
add Destructible::drop_and_kill()
This should be used when a Destructible-derived object needs to be deleted. Handlers of the DropReferences signal should not responsible for deleting the Destructible, since that would happen in the middle of signal emission. Instead, emit the DropReferences signal, then delete the Destructible.
This commit is contained in:
parent
a1d5294af5
commit
210f58ddb7
1 changed files with 6 additions and 1 deletions
|
|
@ -30,7 +30,12 @@ public:
|
|||
PBD::Signal<void()> Destroyed;
|
||||
PBD::Signal<void()> DropReferences;
|
||||
|
||||
virtual void drop_references () { DropReferences(); }
|
||||
virtual void drop_references () { DropReferences(); }
|
||||
static void drop_and_kill (Destructible* d) {
|
||||
assert (d);
|
||||
d->DropReferences();
|
||||
delete d;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue