Unset last-capture sources when saving session

This prevents accidental deletes of files saved to disk
after the fact. e.g.

* save, delete last capture, quit w/o save.
* save, switch-snapshot, delete last capture.
This commit is contained in:
Robin Gareus 2025-03-01 18:19:04 +01:00
parent 622c27ed74
commit 6535d7ed97
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 7 additions and 1 deletions

View file

@ -4866,7 +4866,6 @@ Session::reset_last_capture_sources ()
continue;
}
tr->reset_last_capture_sources ();
}
}

View file

@ -774,6 +774,13 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
XMLTree tree;
std::string xml_path(_session_dir->root_path());
if (!pending) {
/* Prevent destructive edits after explicit save or snapshot changes.
* Otherwise this one can delete sources used by other snapshot
*/
reset_last_capture_sources ();
}
/* prevent concurrent saves from different threads */
Glib::Threads::Mutex::Lock lm (save_state_lock);