On Wed Sep 6 15:07:32 2023 +0000, Rémi Bernon wrote:
This is also my understanding. Fwiw I believe macdrv also behaves similarly. I don't know if macdrv should be trusted as a reference of a good driver code, but at least there's a precedent. It delegates the input message processing to the window thread, holding a reference to the host window in the event, and retrieving its hwnd from the macdrv event handler (this is different from what you are going to do, calling __wine_send_input directly). *But* the input event is received on a different thread, and I think it's possible for the Win32 window to be destroyed before the input event is processed, thus ending up using a stale hwnd.
Fwiw you could perhaps also do wl_surface_set_user_data(wl_surface, 0) when it is destroyed, but I don't know how whether it synchronizes properly or if it would then require locking.