From 41c45f36866934f8da8a710aa12a2f374fca9275 Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Thu, 23 Jul 2015 00:07:48 +0900 Subject: [PATCH] mciseq: Ensure the player thread termination when stopping. --- dlls/mciseq/mcimidi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/mciseq/mcimidi.c b/dlls/mciseq/mcimidi.c index 62b319207b..864ab98067 100644 --- a/dlls/mciseq/mcimidi.c +++ b/dlls/mciseq/mcimidi.c @@ -776,7 +776,7 @@ static DWORD MIDI_mciStop(WINE_MCIMIDI* wmm, DWORD dwFlags, LPMCI_GENERIC_PARMS if (oldstat == MCI_MODE_PAUSE) dwRet = midiOutReset((HMIDIOUT)wmm->hMidi); - if ((dwFlags & MCI_WAIT) && wmm->hThread) + if (wmm->hThread) WaitForSingleObject(wmm->hThread, INFINITE); } @@ -808,7 +808,10 @@ static DWORD MIDI_mciClose(WINE_MCIMIDI* wmm, DWORD dwFlags, LPMCI_GENERIC_PARMS wmm->hFile = 0; TRACE("hFile closed !\n"); } - if (wmm->hThread) CloseHandle(wmm->hThread); + if (wmm->hThread) { + CloseHandle(wmm->hThread); + wmm->hThread = 0; + } HeapFree(GetProcessHeap(), 0, wmm->tracks); HeapFree(GetProcessHeap(), 0, wmm->lpstrElementName); HeapFree(GetProcessHeap(), 0, wmm->lpstrCopyright);