fix save_as()' inadvertent marking a session as dirty during the process of saving state to disk

This commit is contained in:
Paul Davis 2017-02-09 12:25:09 +01:00
parent 3dbea92519
commit b572f1a617
1 changed files with 17 additions and 1 deletions

View File

@ -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.
*/