Jinoh Kang (@iamahuman) commented about dlls/win32u/input.c:
- SERVER_START_REQ( set_cursor ) + while (get_shared_desktop( &lock )) { - if ((ret = !wine_server_call( req ))) + SHARED_READ_BEGIN( &lock.shared->desktop, desktop_shm_t ) { - pt->x = reply->new_x; - pt->y = reply->new_y; - last_change = reply->last_change; + if ((valid = lock.id == shared->obj.id)) + { + pt->x = shared->cursor.x; + pt->y = shared->cursor.y; + last_change = shared->cursor.last_change; + ret = TRUE; + } Solution: For the reasons above, I think we should just abolish `if()`s that depend on shared memory value.[^1]
```suggestion:-6+0 valid = lock.id == shared->obj.id; pt->x = shared->cursor.x; pt->y = shared->cursor.y; last_change = shared->cursor.last_change; ``` [^1]: Previously, I thought `if()`s were more or less harmless in seqlocks if used carefully. Now that I think about it, the shared object can get invalid *at any time* and turn into another object type (e.g., `valid` might be set to TRUE but then subsequent reads like `shared->cursor.x` might return inconsistent value, before the shared read loop detects seq change and retries). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3103#note_63377