From 73c5bdd3cb08ad0888fafe2f4018c3f2a575340c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 28 Feb 2020 02:09:58 +0100 Subject: [PATCH] Fix double free of undo commands (amend 9e6435ff145) This fixes a case when deleting a plugin, deletes all automation undo/redo events: ... `delete this;` calls the d'tor which emits drop_references(), that leads to UndoTransaction::command_death() destroying the object, whichh causes a double free. --- libs/pbd/pbd/memento_command.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h index 6150ea111d..22b2d4a42d 100644 --- a/libs/pbd/pbd/memento_command.h +++ b/libs/pbd/pbd/memento_command.h @@ -127,7 +127,8 @@ public: } void binder_dying () { - delete this; + /* delegate to UndoTransaction::command_death */ + drop_references (); } void operator() () {