From 6e485c0fc1425de78e21ea1aeec6233b136681dd Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 6 Apr 2013 09:13:39 -0400 Subject: fix reload of Generic MIDI binding state when the target state involves just a binding map, with no specific controller bindings at all (should fix #5210) --- .../generic_midi/generic_midi_control_protocol.cc | 54 +++++++++++----------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index deb19e0103..b524e2f2a0 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -528,41 +528,39 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version) pending_controllables.clear (); } + /* Load up specific bindings from the + * ... section + */ + { Glib::Threads::Mutex::Lock lm2 (controllables_lock); controllables.clear (); nlist = node.children(); // "Controls" - if (nlist.empty()) { - return 0; - } - - nlist = nlist.front()->children(); // "MIDIControllable" ... - - if (nlist.empty()) { - return 0; - } + if (!nlist.empty()) { + nlist = nlist.front()->children(); // "MIDIControllable" ... - for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - - - - if ((prop = (*niter)->property ("id")) != 0) { - - ID id = prop->value (); - Controllable* c = Controllable::by_id (id); - - if (c) { - MIDIControllable* mc = new MIDIControllable (this, *_input_port, *c, false); - - if (mc->set_state (**niter, version) == 0) { - controllables.push_back (mc); - } + if (!nlist.empty()) { + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - } else { - warning << string_compose ( - _("Generic MIDI control: controllable %1 not found in session (ignored)"), - id) << endmsg; + if ((prop = (*niter)->property ("id")) != 0) { + + ID id = prop->value (); + Controllable* c = Controllable::by_id (id); + + if (c) { + MIDIControllable* mc = new MIDIControllable (this, *_input_port, *c, false); + + if (mc->set_state (**niter, version) == 0) { + controllables.push_back (mc); + } + + } else { + warning << string_compose ( + _("Generic MIDI control: controllable %1 not found in session (ignored)"), + id) << endmsg; + } + } } } } -- cgit v1.2.3