diff options
author | Robin Gareus <robin@gareus.org> | 2020-02-25 15:24:01 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-02-25 16:17:00 +0100 |
commit | 28c141d450a3aa6c4c519c2148b8c07dd37b7e68 (patch) | |
tree | 67b851993b4a2aaebd02e93627710a47d74247b8 /libs/ardour/session_state.cc | |
parent | 3aaaa7e4593b456362b622d2ad12cf39a588a41f (diff) |
Remove history file when it's empty
Various operations clear the history (e.g. cleanup). In that
case the GUI correctly had an empty Undo/Redo history, but the
file on disk was left in place.
Next session load restored the old, incorrect Undo/Redo history.
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 395329195e..7d24830e69 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -3817,11 +3817,6 @@ Session::save_history (string snapshot_name) return 0; } - if (!Config->get_save_history() || Config->get_saved_history_depth() < 0 || - (_history.undo_depth() == 0 && _history.redo_depth() == 0)) { - return 0; - } - if (snapshot_name.empty()) { snapshot_name = _current_snapshot_name; } @@ -3838,6 +3833,11 @@ Session::save_history (string snapshot_name) } } + if (!Config->get_save_history() || Config->get_saved_history_depth() < 0 || + (_history.undo_depth() == 0 && _history.redo_depth() == 0)) { + return 0; + } + tree.set_root (&_history.get_state (Config->get_saved_history_depth())); if (!tree.write (xml_path)) |