diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index ebf15513a2..bfc029ff93 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1633,10 +1633,11 @@ private: XMLTree* state_tree; StateOfTheState _state_of_the_state; - friend class StateProtector; - std::atomic _suspend_save; - volatile bool _save_queued; - volatile bool _save_queued_pending; + friend class StateProtector; + std::atomic _suspend_save; + volatile bool _save_queued; + volatile bool _save_queued_pending; + bool _no_save_signal; Glib::Threads::Mutex save_state_lock; Glib::Threads::Mutex save_source_lock; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index c09ff047f3..f6851f9ba4 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -751,7 +751,9 @@ Session::remove_state (string snapshot_name) xml_path, g_strerror (errno)) << endmsg; } - StateSaved (snapshot_name); /* EMIT SIGNAL */ + if (!_no_save_signal) { + StateSaved (snapshot_name); /* EMIT SIGNAL */ + } } /** @param snapshot_name Name to save under, without .ardour / .pending prefix */ @@ -924,7 +926,9 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot unset_dirty (/* EMIT SIGNAL */ true); } - StateSaved (snapshot_name); /* EMIT SIGNAL */ + if (!_no_save_signal) { + StateSaved (snapshot_name); /* EMIT SIGNAL */ + } } #ifndef NDEBUG @@ -5544,11 +5548,18 @@ Session::save_as (SaveAs& saveas) store_recent_sessions (_name, _path); + std::cerr << "Saveas, switch to: " << saveas.switch_to << std::endl; + if (!saveas.switch_to) { + std::cerr << "no switch to!\n"; + /* save the new state */ - save_state ("", false, false, !saveas.include_media); + { + PBD::Unwinder uw (_no_save_signal, true); + save_state ("", false, false, !saveas.include_media); + } /* switch back to the way things were */