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:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user