Allow StateProtector to save pending files
This is in preparation for saving state while the session is record-arm'ed. Most notably config changes and undo/redo. In case both normal and pending save happens, pending must be last and is required to recover from crashes during recording.
This commit is contained in:
parent
998fadda57
commit
0d127813fb
@ -628,6 +628,10 @@ public:
|
|||||||
_session->_save_queued = false;
|
_session->_save_queued = false;
|
||||||
_session->save_state ("");
|
_session->save_state ("");
|
||||||
}
|
}
|
||||||
|
while (_session->_save_queued_pending) {
|
||||||
|
_session->_save_queued_pending = false;
|
||||||
|
_session->save_state ("", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@ -1413,6 +1417,8 @@ private:
|
|||||||
friend class StateProtector;
|
friend class StateProtector;
|
||||||
gint _suspend_save; /* atomic */
|
gint _suspend_save; /* atomic */
|
||||||
volatile bool _save_queued;
|
volatile bool _save_queued;
|
||||||
|
volatile bool _save_queued_pending;
|
||||||
|
|
||||||
Glib::Threads::Mutex save_state_lock;
|
Glib::Threads::Mutex save_state_lock;
|
||||||
Glib::Threads::Mutex save_source_lock;
|
Glib::Threads::Mutex save_source_lock;
|
||||||
Glib::Threads::Mutex peak_cleanup_lock;
|
Glib::Threads::Mutex peak_cleanup_lock;
|
||||||
|
@ -785,10 +785,20 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_atomic_int_get(&_suspend_save)) {
|
if (g_atomic_int_get(&_suspend_save)) {
|
||||||
_save_queued = true;
|
/* StateProtector cannot be used for templates or save-as */
|
||||||
|
assert (!template_only && !switch_to_snapshot && !for_archive && snapshot_name.empty ());
|
||||||
|
if (pending) {
|
||||||
|
_save_queued_pending = true;
|
||||||
|
} else {
|
||||||
|
_save_queued = true;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
_save_queued = false;
|
if (pending) {
|
||||||
|
_save_queued_pending = false;
|
||||||
|
} else {
|
||||||
|
_save_queued = false;
|
||||||
|
}
|
||||||
|
|
||||||
snapshot_t fork_state = NormalSave;
|
snapshot_t fork_state = NormalSave;
|
||||||
if (!snapshot_name.empty() && snapshot_name != _current_snapshot_name && !template_only && !pending && !for_archive) {
|
if (!snapshot_name.empty() && snapshot_name != _current_snapshot_name && !template_only && !pending && !for_archive) {
|
||||||
|
Loading…
Reference in New Issue
Block a user