diff options
author | Robin Gareus <robin@gareus.org> | 2020-04-18 23:54:24 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-04-18 23:54:24 +0200 |
commit | 9875a958295353aabba73fb05f862c4f92ebb219 (patch) | |
tree | f4cb3e16bd776483c4f90f0d964d288a797ddd52 /libs/ardour/ardour/session.h | |
parent | b7c7c02680fc89f58af46498b5d6459b30a07b2d (diff) |
RAII collect processor-change signals6.0-rc1
Diffstat (limited to 'libs/ardour/ardour/session.h')
-rw-r--r-- | libs/ardour/ardour/session.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 4c93ecb95f..4c259232f5 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -646,23 +646,27 @@ public: }; class ProcessorChangeBlocker { - public: - ProcessorChangeBlocker (Session* s, bool rc = true) - : _session (s) - , _reconfigure_on_delete (rc) - { - g_atomic_int_inc (&s->_ignore_route_processor_changes); - } - ~ProcessorChangeBlocker () { - if (g_atomic_int_dec_and_test (&_session->_ignore_route_processor_changes)) { + public: + ProcessorChangeBlocker (Session* s, bool rc = true) + : _session (s) + , _reconfigure_on_delete (rc) + { + g_atomic_int_inc (&s->_ignore_route_processor_changes); + } + + ~ProcessorChangeBlocker () + { + if (g_atomic_int_dec_and_test (&_session->_ignore_route_processor_changes)) { + if (g_atomic_int_compare_and_exchange (&_session->_ignored_a_processor_change, 1, 0)) { if (_reconfigure_on_delete) { _session->route_processors_changed (RouteProcessorChange ()); } } } - private: - Session* _session; - bool _reconfigure_on_delete; + } + private: + Session* _session; + bool _reconfigure_on_delete; }; RouteGroup* new_route_group (const std::string&); @@ -2128,6 +2132,7 @@ private: friend class ProcessorChangeBlocker; gint _ignore_route_processor_changes; /* atomic */ + gint _ignored_a_processor_change; MidiClockTicker* midi_clock; |