StateOfTheState state_of_the_state() const { return _state_of_the_state; }
+ class StateProtector {
+ public:
+ StateProtector (Session* s) : _session (s) {
+ g_atomic_int_inc (&s->_suspend_save);
+ }
+ ~StateProtector () {
+ if (g_atomic_int_dec_and_test (&_session->_suspend_save)) {
+ while (_session->_save_queued) {
+ _session->_save_queued = false;
+ _session->save_state ("");
+ }
+ }
+ }
+ private:
+ Session * _session;
+ };
+
void add_route_group (RouteGroup *);
void remove_route_group (RouteGroup&);
void reorder_route_groups (std::list<RouteGroup*>);
bool state_was_pending;
StateOfTheState _state_of_the_state;
+ friend class StateProtector;
+ gint _suspend_save; /* atomic */
+ volatile bool _save_queued;
+
void auto_save();
int load_options (const XMLNode&);
int load_state (std::string snapshot_name);
static int get_session_info_from_path (XMLTree& state_tree, const std::string& xmlpath);
};
+
} // namespace ARDOUR
#endif /* __ardour_session_h__ */
, state_tree (0)
, state_was_pending (false)
, _state_of_the_state (StateOfTheState(CannotSave|InitialConnecting|Loading))
+ , _suspend_save (0)
+ , _save_queued (false)
, _last_roll_location (0)
, _last_roll_or_reversal_location (0)
, _last_record_location (0)
return 1;
}
+ if (g_atomic_int_get(&_suspend_save)) {
+ _save_queued = true;
+ return 1;
+ }
+ _save_queued = false;
+
if (!_engine.connected ()) {
error << string_compose (_("the %1 audio engine is not connected and state saving would lose all I/O connections. Session not saved"),
PROGRAM_NAME)