http://bugs.winehq.org/show_bug.cgi?id=30978
--- Comment #9 from Andrew Eikum aeikum@codeweavers.com 2012-09-05 10:44:52 CDT --- So this is a multi-threading issue.
SharpEye sends an MCI_PLAY command, which Wine's mciseq starts asynchronously in another thread and returns. That is immediately followed by an MCI_STATUS command, asking for the current MCI mode. Since the playing thread has not yet begun to play the MIDI file, the mode returned is MCI_MODE_STOP, which SharpEye interprets as an error. SharpEye starts sending shut down commands to the MCI driver. Because Wine's mciseq is buggy, that causes a crash when the playing thread tries to use resources that were freed during the shutdown in the other thread.
It appears SharpEye expects the mode to be set to MCI_MODE_PLAY immediately when its MCI_PLAY command returns, even though it begins asynchronously. We should add some tests for this, and repair mciseq's asynchronous mode to block main thread calls until it has actually started playing, and fix its use-after-free while we're working in there.