When we originally implemented MIDI scripting, we were getting segfaults when lots of MIDI data/script functions were running. We now know that this was due to the wrong threads calling the script functions (specifically the MidiDevice thread was directly calling MidiScriptEngine functions.) At the time, we added a bunch of mutexes to the MidiScriptEngine. Once the real problem was discovered, I fixed it back in the features_HSS1394 branch by using signals/slots, but the mutexes remain and I believe are the source for any random MIDI-related deadlocks.
This bug is to remind me to remove all of those, since all MidiScriptEngine functions should only be called by the MidiScriptEngine thread. (I might add ASSERTs to ensure this.)
This might be responsible for bug #342952, so re-check that after this is fixed.