summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/session_state.cc')
-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.
*/