summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2017-02-09 12:25:09 +0100
committerPaul Davis <paul@linuxaudiosystems.com>2017-02-09 12:40:59 +0100
commitb572f1a61770abaa41e91ebe6b5988b6483d7f2b (patch)
tree7beb88a90d1e84943fa1df5274a8ccf0c91971c2
parent3dbea92519a2e21fc36fc2430b6b28dd233a80eb (diff)
fix save_as()' inadvertent marking a session as dirty during the process of saving state to disk
-rw-r--r--libs/ardour/session_state.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index e0edfa6b2d..b2d3fbb083 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -4976,7 +4976,6 @@ Session::save_as (SaveAs& saveas)
bool was_dirty = dirty ();
- save_state ("", false, false, !saveas.include_media);
save_default_options ();
if (saveas.copy_media && saveas.copy_external) {
@@ -4991,6 +4990,10 @@ Session::save_as (SaveAs& saveas)
if (!saveas.switch_to) {
+ /* save the new state */
+
+ save_state ("", false, false, !saveas.include_media);
+
/* switch back to the way things were */
_path = old_path;
@@ -5024,6 +5027,19 @@ Session::save_as (SaveAs& saveas)
*/
reset_write_sources (true, true);
+ /* creating new write sources marks the session as
+ dirty. If the new session is empty, then
+ save_state() thinks we're saving a template and will
+ not mark the session as clean. So do that here,
+ before we save state.
+ */
+
+ if (!saveas.include_media) {
+ _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
+ }
+
+ save_state ("", false, false, !saveas.include_media);
+
/* the copying above was based on actually discovering files, not just iterating over the sources list.
But if we're going to switch to the new (copied) session, we need to change the paths in the sources also.
*/