From 7ade596c92b00eae871e8f2f5b5d6e0d1ebd93d7 Mon Sep 17 00:00:00 2001 From: nick_m Date: Mon, 2 Nov 2015 02:12:54 +1100 Subject: Clean up _before XMLNode in AutomationList if no automation write occurred. --- libs/ardour/automation_control.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libs/ardour/automation_control.cc') diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index 671cd6e977..1f507b7015 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -163,11 +163,15 @@ AutomationControl::stop_touch(bool mark, double when) } void -AutomationControl::commit_transaction () +AutomationControl::commit_transaction (bool did_write) { - if (alist ()->before ()) { - _session.begin_reversible_command (string_compose (_("record %1 automation"), name ())); - _session.commit_reversible_command (new MementoCommand (*alist ().get (), alist ()->before (), &alist ()->get_state ())); + if (did_write) { + if (alist ()->before ()) { + _session.begin_reversible_command (string_compose (_("record %1 automation"), name ())); + _session.commit_reversible_command (new MementoCommand (*alist ().get (), alist ()->before (), &alist ()->get_state ())); + } + } else { + alist ()->clear_history (); } } -- cgit v1.2.3