summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/music/win32_m.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp
index abc0fcd72..1447fd88a 100644
--- a/src/music/win32_m.cpp
+++ b/src/music/win32_m.cpp
@@ -312,10 +312,14 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW
void MusicDriver_Win32::PlaySong(const MusicSongInfo &song)
{
DEBUG(driver, 2, "Win32-MIDI: PlaySong: entry");
- std::lock_guard mutex_lock(_midi.lock);
- if (!_midi.next_file.LoadSong(song)) return;
+ MidiFile new_song;
+ if (!new_song.LoadSong(song)) return;
+ DEBUG(driver, 2, "Win32-MIDI: PlaySong: Loaded song");
+
+ std::lock_guard mutex_lock(_midi.lock);
+ _midi.next_file.MoveFrom(new_song);
_midi.next_segment.start = song.override_start;
_midi.next_segment.end = song.override_end;
_midi.next_segment.loop = song.loop;