https://bugs.winehq.org/show_bug.cgi?id=39348
--- Comment #1 from Stefan Dösinger stefan@codeweavers.com --- I'm aware of this problem, and it's a tough one to fix. The problem is that ddraw.dll tries to destroy ddraw objects on DLL unload, mainly to get the screen resolution restored if the game doesn't properly take care of that itself. However, by the time PROCESS_DETACH is handled, the worker thread is long dead and the main thread waits forever for commands to be executed.
Removing those cleanup calls is easy, but it'll mean that the screen resolution in the affected games won't be restored. To properly fix this we'll need a proper screen resolution restore fix either in the X server itself, window manager or maybe explorer.exe.
My suggested workaround for wine-staging is to keep CSMT off for ddraw. There are more problems with it (e.g. still using excessive sync due to improperly handled operations, not working if the game uses ddraw from inside DllMain), and since the games are old the positive impact of CSMT will be limited anyway.