mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 15:16:25 +01:00
add mutex to prevent concurrent session state saves.
Why wasn't this done 10 years ago?
This commit is contained in:
parent
a0fdeed441
commit
57d0aa4354
2 changed files with 5 additions and 0 deletions
|
|
@ -1135,6 +1135,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
|
||||||
friend class StateProtector;
|
friend class StateProtector;
|
||||||
gint _suspend_save; /* atomic */
|
gint _suspend_save; /* atomic */
|
||||||
volatile bool _save_queued;
|
volatile bool _save_queued;
|
||||||
|
Glib::Threads::Mutex save_state_lock;
|
||||||
|
|
||||||
int load_options (const XMLNode&);
|
int load_options (const XMLNode&);
|
||||||
int load_state (std::string snapshot_name);
|
int load_state (std::string snapshot_name);
|
||||||
|
|
|
||||||
|
|
@ -689,6 +689,10 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
|
||||||
XMLTree tree;
|
XMLTree tree;
|
||||||
std::string xml_path(_session_dir->root_path());
|
std::string xml_path(_session_dir->root_path());
|
||||||
|
|
||||||
|
/* prevent concurrent saves from different threads */
|
||||||
|
|
||||||
|
Glib::Threads::Mutex::Lock lm (save_state_lock);
|
||||||
|
|
||||||
if (!_writable || (_state_of_the_state & CannotSave)) {
|
if (!_writable || (_state_of_the_state & CannotSave)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue