From: Bernhard Übelacker bernhardu@mailbox.org
The gitlab runners where showing a few flaky crashes in e.g. tests: dmsynth:dmsynth dmusic:dmusic winmm:midi
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58233 --- dlls/mmdevapi/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c index 551d53ccb7f..c61afe06396 100644 --- a/dlls/mmdevapi/main.c +++ b/dlls/mmdevapi/main.c @@ -307,6 +307,7 @@ static IClassFactoryImpl MMDEVAPI_CF[] = { };
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; +static HANDLE notify_thread_handle;
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { @@ -384,14 +385,17 @@ LRESULT WINAPI DriverProc( DWORD_PTR id, HANDLE driver, UINT msg, LPARAM param1,
params.err = &err; MIDI_CALL( midi_init, ¶ms ); - if (err == DRV_SUCCESS) CloseHandle( CreateThread( NULL, 0, notify_thread, NULL, 0, NULL )); + if (err == DRV_SUCCESS) notify_thread_handle = CreateThread( NULL, 0, notify_thread, NULL, 0, NULL ); return err; } case DRV_FREE: + case DRV_CLOSE: MIDI_CALL( midi_release, NULL ); + WaitForSingleObject(notify_thread_handle, INFINITE); + CloseHandle(notify_thread_handle); + notify_thread_handle = NULL; return 1; case DRV_OPEN: - case DRV_CLOSE: case DRV_QUERYCONFIGURE: case DRV_CONFIGURE: return 1;