summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_time_axis.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-26 22:30:34 +0000
committerDavid Robillard <d@drobilla.net>2013-01-26 22:30:34 +0000
commit03e06e71d6e648d2ea06a922b9524a118211f9b5 (patch)
tree6375f82c9993c91563afb119dec22d01cf671462 /gtk2_ardour/midi_time_axis.cc
parent84eee94b1e7fea035f1089d52c75c2d51ed5d5ca (diff)
Fix border case where bank select controlers are last in midnam file.
Fix potential infinite loop in controller menu generation. git-svn-id: svn://localhost/ardour2/branches/3.0@14001 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r--gtk2_ardour/midi_time_axis.cc29
1 files changed, 13 insertions, 16 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index fc87ed89d0..9fe3a77450 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -837,27 +837,24 @@ MidiTimeAxisView::build_controller_menu ()
for (ControlNameList::Controls::const_iterator c = name_list->controls().begin();
c != name_list->controls().end();) {
const uint16_t ctl = c->second->number();
- if (ctl == MIDI_CTL_MSB_BANK || ctl == MIDI_CTL_LSB_BANK) {
+ if (ctl != MIDI_CTL_MSB_BANK && ctl != MIDI_CTL_LSB_BANK) {
/* Skip bank select controllers since they're handled specially */
- /* FIXME: If this is the last control, the last submenu might be lost */
- continue;
- }
-
- if (n_items == 0) {
- /* Create a new submenu */
- ctl_menu = manage (new Menu);
- }
+ if (n_items == 0) {
+ /* Create a new submenu */
+ ctl_menu = manage (new Menu);
+ }
- MenuList& ctl_items (ctl_menu->items());
- if (chn_cnt > 1) {
- add_multi_channel_controller_item(ctl_items, ctl, c->second->name());
- } else {
- add_single_channel_controller_item(ctl_items, ctl, c->second->name());
+ MenuList& ctl_items (ctl_menu->items());
+ if (chn_cnt > 1) {
+ add_multi_channel_controller_item(ctl_items, ctl, c->second->name());
+ } else {
+ add_single_channel_controller_item(ctl_items, ctl, c->second->name());
+ }
}
++c;
- if (++n_items == 16 || c == name_list->controls().end()) {
- /* Submenu has 16 items, add it to controller menu and reset */
+ if (ctl_menu && (++n_items == 16 || c == name_list->controls().end())) {
+ /* Submenu has 16 items or we're done, add it to controller menu and reset */
items.push_back(
MenuElem(string_compose(_("Controllers %1-%2"),
(16 * n_groups), (16 * n_groups) + n_items - 1),