This is a fix for the bug described in
The bug can cause the entire computer to lock up when
Zyn is built with ALSA MIDI but started on a system
that doesn't have snd-seq loaded (and has blocked the
automatic loading of it by e.g. adding the line
'install snd-seq /bin/true' to /etc/modprobe.conf).
The patch adds two lines of code and two lines of
comment. One of the code lines is in the function
ALSAMidiIn::getmidicmd(). When the ALSA MIDI input has
been created successfully, this function calls the
blocking function snd_seq_event_input() to get next
MIDI event. ALSAMidiIn::getmidicmd() is called in a
non-blocking loop running in a realtime scheduled
thread, so this is the only time when other non-RT
threads get a chance to run. However, when the ALSA
MIDI input has _not_ been created successfully, this
function will just return and the thread will never
ever let non-RT threads run. This patch adds a call to
sleep() to fix that. It is only called when the ALSA
MIDI input already is broken, so it does not affect the
timing for a working input.
Also, the destructor of ALSAMidiIn tries to call
snd_seq_close() for the MIDI input, regardless of
whether it was created successfully or not. When it
isn't, that will lead to a crash. This patch adds a
check so it only calls snd_seq_close() if it actually
has something to close.
Log in to post a comment.