http://bugs.winehq.org/show_bug.cgi?id=28597
--- Comment #6 from Andrew Eikum aeikum@codeweavers.com 2011-10-27 07:42:57 CDT --- (In reply to comment #5)
I don't understand why the future IMMNotificationClient would help. Your suspicion in comment #1 seems very reasonable, the user expects to have "test sound" take effect immediately (this was a long-standing bug), so the goal is to have winmm shut down properly and be able to reload it.
WinMM would use IMMNotificationClient to know when the default has changed, and reroute its audio appropriately. MMDevAPI could monitor the registry in certain function calls (GetDefaultAudioEndpoint at least) and send notifications when it finds that the default has changed. Then WinMM never needs to be unloaded.
What does prevent winmm from shutting down its devices thread properly? your patch sounds like a work-around the bug that winmm may not unload properly, which sounds like it could potentially affect any app that dynamically loads it (probably a minority).
This is true. I believe there are ways to prevent DLLs from ever unloading, which would be a solution to that problem. I don't know enough about DLL loading and unloading to know how to test for this right now.
This all needs more tests, obviously, but the patch fixes this particular crash, at least.