13
0

Fix add/remove ALSA-MIDI ports bug

This commit is contained in:
Robin Gareus 2019-05-05 18:06:37 +02:00
parent 5bde8f4456
commit c5346f5c15
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -692,9 +692,10 @@ AlsaAudioBackend::set_midi_device_enabled (std::string const device, bool enable
assert (_rmidi_out.size() > i);
AlsaMidiOut *rm = _rmidi_out.at(i);
if (rm->name () != device) { ++it; ++i; continue; }
it = _system_midi_out.erase (it);
unregister_port (*it);
it = _system_midi_out.erase (it);
rm->stop();
assert (rm == *(_rmidi_out.begin() + i));
_rmidi_out.erase (_rmidi_out.begin() + i);
delete rm;
}
@ -704,9 +705,10 @@ AlsaAudioBackend::set_midi_device_enabled (std::string const device, bool enable
assert (_rmidi_in.size() > i);
AlsaMidiIn *rm = _rmidi_in.at(i);
if (rm->name () != device) { ++it; ++i; continue; }
it = _system_midi_in.erase (it);
unregister_port (*it);
it = _system_midi_in.erase (it);
rm->stop();
assert (rm == *(_rmidi_in.begin() + i));
_rmidi_in.erase (_rmidi_in.begin() + i);
delete rm;
}