From: Robin Gareus Date: Sat, 9 Sep 2017 01:07:43 +0000 (+0200) Subject: GUI part of LV2 midnam race condition fix X-Git-Tag: 5.12~15 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=2513343204b5fb1256b15bce2058fcfd52d9432a GUI part of LV2 midnam race condition fix ..and support for midnam patches on MIDI Busses. --- diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 1f38efea44..62a69bef1e 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -677,6 +677,8 @@ GenericPluginUI::build_midi_table () pgm_table->attach (*cui, col, col + 1, row, row+1, FILL|EXPAND, FILL); } + insert->plugin ()->read_midnam(); + midi_refill_patches (); insert->plugin()->BankPatchChange.connect ( @@ -684,12 +686,7 @@ GenericPluginUI::build_midi_table () boost::bind (&GenericPluginUI::midi_bank_patch_change, this, _1), gui_context()); - /* Note: possible race with MidiTimeAxisView::update_patch_selector() - * which uses this signal to update/re-register the midnam (also in gui context). - * MTAV does register before us, so the midnam should already be updated when - * we're notified. - */ - insert->plugin()->UpdateMidnam.connect ( + insert->plugin()->UpdatedMidnam.connect ( midi_connections, invalidator (*this), boost::bind (&GenericPluginUI::midi_refill_patches, this), gui_context()); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 3627074bc8..c8476dc83e 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -427,6 +427,7 @@ MidiTimeAxisView::update_patch_selector () pi->plugin()->UpdateMidnam.connect (midnam_connection, invalidator (*this), boost::bind (&MidiTimeAxisView::reread_midnam, this), gui_context()); + reread_midnam (); pluginprovided = true; std::string model_name = pi->plugin ()->midnam_model (); @@ -450,9 +451,9 @@ MidiTimeAxisView::reread_midnam () { boost::shared_ptr the_instrument (_route->the_instrument()); boost::shared_ptr pi = boost::dynamic_pointer_cast(the_instrument); - pi->plugin ()->read_midnam(); + bool rv = pi->plugin ()->read_midnam(); - if (_patch_change_dialog) { + if (rv && _patch_change_dialog) { _patch_change_dialog->refresh (); } }