Fix saving automation record undo
authorRobin Gareus <robin@gareus.org>
Mon, 24 Jul 2017 00:59:09 +0000 (02:59 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 24 Jul 2017 00:59:09 +0000 (02:59 +0200)
Calling AutomationList::before() clears the state.

libs/ardour/automation_control.cc

index 274e84f9f072f2848d08dbd054d4e5416e84bf8a..e9bc1aebe052ba34b0920959e27dba4ad9a11dd3 100644 (file)
@@ -310,9 +310,10 @@ void
 AutomationControl::commit_transaction (bool did_write)
 {
        if (did_write) {
-               if (alist ()->before ()) {
+               XMLNode* before = alist ()->before ();
+               if (before) {
                        _session.begin_reversible_command (string_compose (_("record %1 automation"), name ()));
-                       _session.commit_reversible_command (new MementoCommand<AutomationList> (*alist ().get (), alist ()->before (), &alist ()->get_state ()));
+                       _session.commit_reversible_command (alist ()->memento_command (before, &alist ()->get_state ()));
                }
        } else {
                alist ()->clear_history ();