Rémi Bernon (@rbernon) commented about dlls/mmdevapi/main.c:
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: MIDI_CALL( midi_release, NULL ); + WaitForSingleObject(notify_thread_handle, INFINITE); + CloseHandle(notify_thread_handle); + notify_thread_handle = NULL;
```suggestion:-2+0 WaitForSingleObject( notify_thread_handle, INFINITE ); CloseHandle( notify_thread_handle ); notify_thread_handle = NULL; ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8066#note_105749