diff -urpN Ardour-6.6.0.orig/gtk2_ardour/midi_tracer.cc Ardour-6.6.0/gtk2_ardour/midi_tracer.cc --- Ardour-6.6.0.orig/gtk2_ardour/midi_tracer.cc 2021-02-22 10:41:53.000000000 -0800 +++ Ardour-6.6.0/gtk2_ardour/midi_tracer.cc 2021-04-22 03:29:24.330977741 -0700 @@ -53,7 +53,6 @@ MidiTracer::MidiTracer () , autoscroll (true) , show_hex (true) , show_delta_time (false) - , _update_queued (0) , fifo (1024) , buffer_pool ("miditracer", buffer_size, 1024) // 1024 256 byte buffers , autoscroll_button (_("Auto-Scroll")) @@ -61,6 +60,8 @@ MidiTracer::MidiTracer () , collect_button (_("Enabled")) , delta_time_button (_("Delta times")) { + g_atomic_int_set (&_update_queued, 0); + ARDOUR::AudioEngine::instance()->PortRegisteredOrUnregistered.connect (_manager_connection, invalidator (*this), boost::bind (&MidiTracer::ports_changed, this), gui_context()); @@ -407,9 +408,8 @@ MidiTracer::tracer (Parser&, byte* msg, fifo.write (&buf, 1); - if (g_atomic_int_get (const_cast (&_update_queued)) == 0) { + if (g_atomic_int_compare_and_exchange (&_update_queued, 0, 1)) { gui_context()->call_slot (invalidator (*this), boost::bind (&MidiTracer::update, this)); - g_atomic_int_inc (const_cast (&_update_queued)); } } @@ -417,7 +417,7 @@ void MidiTracer::update () { bool updated = false; - g_atomic_int_dec_and_test (const_cast (&_update_queued)); + g_atomic_int_set (&_update_queued, 0); RefPtr buf (text.get_buffer()); diff -urpN Ardour-6.6.0.orig/gtk2_ardour/midi_tracer.h Ardour-6.6.0/gtk2_ardour/midi_tracer.h --- Ardour-6.6.0.orig/gtk2_ardour/midi_tracer.h 2021-02-22 10:41:53.000000000 -0800 +++ Ardour-6.6.0/gtk2_ardour/midi_tracer.h 2021-04-22 03:29:24.330977741 -0700 @@ -34,6 +34,8 @@ #include "pbd/signals.h" #include "pbd/ringbuffer.h" #include "pbd/pool.h" +#include "pbd/g_atomic_compat.h" + #include "midi++/types.h" #include "ardour_window.h" @@ -68,7 +70,7 @@ private: * equal to 0 when an update is not queued. May temporarily be negative if a * update is handled before it was noted that it had just been queued. */ - volatile gint _update_queued; + GATOMIC_QUAL gint _update_queued; PBD::RingBuffer fifo; Pool buffer_pool; diff -urpN Ardour-6.6.0.orig/gtk2_ardour/public_editor.cc Ardour-6.6.0/gtk2_ardour/public_editor.cc --- Ardour-6.6.0.orig/gtk2_ardour/public_editor.cc 2021-02-22 10:41:53.000000000 -0800 +++ Ardour-6.6.0/gtk2_ardour/public_editor.cc 2021-04-22 03:29:24.330977741 -0700 @@ -33,8 +33,8 @@ sigc::signal PublicEditor::DropDow PublicEditor::PublicEditor (Gtk::Widget& content) : Tabbable (content, _("Editor"), X_("editor")) - , _suspend_route_redisplay_counter (0) { + g_atomic_int_set (&_suspend_route_redisplay_counter, 0); } PublicEditor::~PublicEditor() diff -urpN Ardour-6.6.0.orig/gtk2_ardour/public_editor.h Ardour-6.6.0/gtk2_ardour/public_editor.h --- Ardour-6.6.0.orig/gtk2_ardour/public_editor.h 2021-02-22 10:41:53.000000000 -0800 +++ Ardour-6.6.0/gtk2_ardour/public_editor.h 2021-04-22 03:29:24.330977741 -0700 @@ -44,6 +44,7 @@ #include #include "pbd/statefuldestructible.h" +#include "pbd/g_atomic_compat.h" #include "temporal/beats.h" @@ -523,13 +524,14 @@ protected: friend class DisplaySuspender; virtual void suspend_route_redisplay () = 0; virtual void resume_route_redisplay () = 0; - gint _suspend_route_redisplay_counter; + + GATOMIC_QUAL gint _suspend_route_redisplay_counter; }; class DisplaySuspender { public: DisplaySuspender() { - if (g_atomic_int_add(&PublicEditor::instance()._suspend_route_redisplay_counter, 1) == 0) { + if (g_atomic_int_add (&PublicEditor::instance()._suspend_route_redisplay_counter, 1) == 0) { PublicEditor::instance().suspend_route_redisplay (); } } diff -urpN Ardour-6.6.0.orig/gtk2_ardour/timers.cc Ardour-6.6.0/gtk2_ardour/timers.cc --- Ardour-6.6.0.orig/gtk2_ardour/timers.cc 2021-02-22 10:41:53.000000000 -0800 +++ Ardour-6.6.0/gtk2_ardour/timers.cc 2021-04-22 03:29:24.330977741 -0700 @@ -22,6 +22,7 @@ #include "pbd/timer.h" #include "pbd/debug.h" #include "pbd/compose.h" +#include "pbd/g_atomic_compat.h" #include "debug.h" @@ -87,8 +88,8 @@ public: , rapid(100) , super_rapid(40) , fps(40) - , _suspend_counter(0) { + g_atomic_int_set (&_suspend_counter, 0); #ifndef NDEBUG second.connect (sigc::mem_fun (*this, &UITimers::on_second_timer)); #endif @@ -100,7 +101,7 @@ public: StandardTimer super_rapid; StandardTimer fps; - gint _suspend_counter; + GATOMIC_QUAL gint _suspend_counter; #ifndef NDEBUG std::vector rapid_eps_count; @@ -212,7 +213,7 @@ fps_connect(const sigc::slot& slot TimerSuspender::TimerSuspender () { - if (g_atomic_int_add(&get_timers()._suspend_counter, 1) == 0) { + if (g_atomic_int_add (&get_timers()._suspend_counter, 1) == 0) { get_timers().rapid.suspend(); get_timers().super_rapid.suspend(); get_timers().fps.suspend();