Retain pending state after recovery (#9215)

After recovering from a crash, the user still needs to
retain the option to ignore the changes that were done
just before the crash after investigating them (or save them
into a snapshot).

Previously crash recovery unconditionally overwrote the
session file (see discussion on bug tracker).
This commit is contained in:
Robin Gareus 2023-02-03 07:50:32 +01:00
parent 1434789103
commit 054e1c3c12
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
3 changed files with 6 additions and 9 deletions

View file

@ -1600,7 +1600,6 @@ private:
std::string _current_snapshot_name;
XMLTree* state_tree;
bool state_was_pending;
StateOfTheState _state_of_the_state;
friend class StateProtector;

View file

@ -239,7 +239,6 @@ Session::Session (AudioEngine &eng,
, _session_dir (new SessionDirectory (fullpath))
, _current_snapshot_name (snapshot_name)
, state_tree (0)
, state_was_pending (false)
, _state_of_the_state (StateOfTheState (CannotSave | InitialConnecting | Loading))
, _save_queued (false)
, _save_queued_pending (false)
@ -613,9 +612,9 @@ Session::destroy ()
{
vector<void*> debug_pointers;
/* if we got to here, leaving pending capture state around
is a mistake.
*/
/* if we got to here, leaving pending state around
* is a mistake.
*/
remove_pending_capture_state ();

View file

@ -423,9 +423,6 @@ Session::session_loaded ()
if (_is_new) {
save_state ("");
} else if (state_was_pending) {
save_state ("");
state_was_pending = false;
}
/* Now, finally, we can fill the playback buffers */
@ -968,7 +965,7 @@ Session::load_state (string snapshot_name, bool from_template)
delete state_tree;
state_tree = 0;
state_was_pending = false;
bool state_was_pending = false;
/* check for leftover pending state from a crashed capture attempt */
@ -982,6 +979,8 @@ Session::load_state (string snapshot_name, bool from_template)
boost::optional<int> r = AskAboutPendingState();
if (r.value_or (1)) {
state_was_pending = true;
} else {
remove_pending_capture_state ();
}
}