X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fpbd%2Fundo.cc;h=182773ee4925c2811074a9420385b22afbfe4906;hb=c99bf353a5cf460f06f78cc542d28624d01233bc;hp=120f62c3512c78d263ae48a3aa6e9990b6eea30b;hpb=f4401c59284258c6aa56707da64e3da32756329f;p=ardour.git diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index 120f62c351..182773ee49 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -18,7 +18,6 @@ $Id$ */ -#include #include #include #include @@ -41,6 +40,7 @@ UndoTransaction::UndoTransaction (const UndoTransaction& rhs) : Command(rhs._name) , _clearing(false) { + _timestamp = rhs._timestamp; clear (); actions.insert(actions.end(),rhs.actions.begin(),rhs.actions.end()); } @@ -220,6 +220,13 @@ UndoHistory::add (UndoTransaction* const ut) } UndoList.push_back (ut); + /* Adding a transacrion makes the redo list meaningless. */ + _clearing = true; + for (std::list::iterator i = RedoList.begin(); i != RedoList.end(); ++i) { + delete *i; + } + RedoList.clear (); + _clearing = false; /* we are now owners of the transaction and must delete it when finished with it */ @@ -294,6 +301,9 @@ void UndoHistory::clear_redo () { _clearing = true; + for (std::list::iterator i = RedoList.begin(); i != RedoList.end(); ++i) { + delete *i; + } RedoList.clear (); _clearing = false; @@ -305,6 +315,9 @@ void UndoHistory::clear_undo () { _clearing = true; + for (std::list::iterator i = UndoList.begin(); i != UndoList.end(); ++i) { + delete *i; + } UndoList.clear (); _clearing = false;