13
0

prevent Session::StateSaved being emitted when doing save-as with no switch-to

The signal would be emitted while the session was temporarily renamed,
making it appear that we had switched to the new session, despite instructions
not to do so. We had not actually done so, but the saved-as name would show up
on window titles.
This commit is contained in:
Paul Davis 2024-09-24 14:50:35 -06:00
parent 72cac07ae7
commit 0e28620a7a
2 changed files with 19 additions and 7 deletions

View File

@ -1633,10 +1633,11 @@ private:
XMLTree* state_tree;
StateOfTheState _state_of_the_state;
friend class StateProtector;
std::atomic<int> _suspend_save;
volatile bool _save_queued;
volatile bool _save_queued_pending;
friend class StateProtector;
std::atomic<int> _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;

View File

@ -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<bool> uw (_no_save_signal, true);
save_state ("", false, false, !saveas.include_media);
}
/* switch back to the way things were */