shithub: choc

Download patch

ref: 1aa667e69a15df8e7352e76c01ad6b5fb917584b
parent: 2d01baab77a509c5167d14ea7ed11d551ca0c664
author: Fabian Greffrath <[email protected]>
date: Fri Aug 30 06:13:40 EDT 2019

midiproc: do not unset midi_server_registered in StopSong()

I_MidiPipe_StopSong() is not the right place to set the
midi_server_registered variable to false, yet.

Why? Because in order to play a new song, the current song must first be
stopped and then unregistered, c.f. S_ChangeMusic() and S_StopMusic().

If the midi_server_initialized variable is alread set to false in
I_MidiPipe_StopSong() then the subsequent call to I_SDL_UnRegisterSong()
will skip the call to I_MidiPipe_UnregisterSong(). Thus, the current song
will never be unregistered, the more complex music backends will not
release the file handle and overriding the temporary music file with the
next song wil fail. After all, we will hear the same song over and over
again as reported in #963.

I hope this will be the final nail in the coffin of this bug
(wow, that felt good!).

--- a/src/i_midipipe.c
+++ b/src/i_midipipe.c
@@ -359,8 +359,6 @@
     ok = WritePipe(packet);
     NET_FreePacket(packet);
 
-    midi_server_registered = false;
-
     ok = ok && BlockForAck();
     if (!ok)
     {