Module: wine Branch: refs/heads/master Commit: ed62b0150c44c3ac4428cd0ca8b3c5658678554d URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=ed62b0150c44c3ac4428cd0c...
Author: Robert Reif reif@earthlink.net Date: Fri May 19 07:34:08 2006 -0400
winmm: Fix wave test handle use after close bug.
---
dlls/winmm/tests/wave.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c index 576de4f..ceeeba0 100644 --- a/dlls/winmm/tests/wave.c +++ b/dlls/winmm/tests/wave.c @@ -534,8 +534,13 @@ static DWORD WINAPI callback_thread(LPVO { MSG msg;
- while (GetMessage(&msg, 0, 0, 0)) - SetEvent((HANDLE)lpParameter); + while (GetMessage(&msg, 0, 0, 0)) { + UINT message = msg.message; + ok (message == WOM_OPEN || message == WOM_DONE || message == WOM_CLOSE, + "GetMessage returned unexpected message: %u\n", message); + if (message == WOM_OPEN || message == WOM_DONE || message == WOM_CLOSE) + SetEvent((HANDLE)lpParameter); + }
return 0; } @@ -579,16 +584,20 @@ static void wave_out_test_deviceOut(int callback_instance = 0; } else { trace("CreateThread() failed\n"); + CloseHandle(hevent); return; } } else if ((flags & CALLBACK_TYPEMASK) == CALLBACK_WINDOW) { trace("CALLBACK_THREAD not implemented\n"); + CloseHandle(hevent); return; } else if (flags && CALLBACK_TYPEMASK) { trace("Undefined callback type!\n"); + CloseHandle(hevent); return; } else { trace("CALLBACK_NULL not implemented\n"); + CloseHandle(hevent); return; } wout=NULL; @@ -728,12 +737,12 @@ static void wave_out_test_deviceOut(int wave_out_error(rc)); free(frag.lpData);
- CloseHandle(hevent); rc=waveOutClose(wout); ok(rc==MMSYSERR_NOERROR,"waveOutClose(%s): rc=%s\n",dev_name(device), wave_out_error(rc)); if ((flags & CALLBACK_TYPEMASK) == CALLBACK_THREAD) TerminateThread(thread, 0); + CloseHandle(hevent); }
static void wave_out_test_device(int device)