diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index e1b9da4b89..7d9c10e29f 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -2009,6 +2009,13 @@ RouteUI::parameter_changed (string const & p) void RouteUI::setup_invert_buttons () { + uint32_t const N = _route ? _route->phase_control()->size() : 0; + + if (_n_polarity_invert == N) { + return; + } + _n_polarity_invert = N; + /* remove old invert buttons */ for (vector::iterator i = _invert_buttons.begin(); i != _invert_buttons.end(); ++i) { _invert_button_box.remove (**i); @@ -2016,11 +2023,10 @@ RouteUI::setup_invert_buttons () _invert_buttons.clear (); - if (!_route) { + if (N == 0) { return; } - uint32_t const N = _route->phase_control()->size(); uint32_t const to_add = (N <= _max_invert_buttons) ? N : 1; for (uint32_t i = 0; i < to_add; ++i) { diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 59bae48549..92f161e3dd 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -345,6 +345,7 @@ private: int _i_am_the_modifier; std::vector _invert_buttons; Gtk::Menu* _invert_menu; + uint32_t _n_polarity_invert; StripableColorDialog _color_picker;