https://bugs.winehq.org/show_bug.cgi?id=38394
--- Comment #2 from Stefan Dösinger stefan@codeweavers.com --- Actually, the problem isn't that tha game calls SetCooperativeLevel while the focus loss handling is in progress. The problem is destroys the ddraw object. Thus once the minimization is done and device_process_message wants to call device_parent->activate it reads freed memory and jumps to a random location (which happens to be 0x00000001).
Some more factoids: *) The same crash happens with Mate and FVWM.
*) This is not a race condition. The messages and SetCooperativeLevel call happen on the same thread. The SetCooperativeLevel call seems to happen in response to a message with id 0xc045. No idea what this is, I can't find it in the headers nor on Google. But it apparently is generated while we're minimizing the window. It is generated in more places
*) Inside a virtual desktop the WM_ACTIVATEAPP(wParam=0) message is never sent. When the game exits OK in KDE/FVWM/Mate the message also isn't generated.
*) The WM_ACTIVATEAPP message is apparently generated when the game destroys an unrelated window.