Repository navigation
Conversation
…ange wait_grab_pointer() retries XGrabPointer() every 10ms until it succeeds. That never happens when the grab is held by another thread of the same process that is blocked in a synchronous SendMessage() to the thread changing focus: the sender cannot release the grab before its message is processed, and the receiver cannot process the message before the grab is released. Bound the wait to one second so that the pending message can be processed and the grab released. The patch has the reproduction details.
|
Thanks for tracking this down, the deadlock is real: the grab can be held by another thread of the same process (capture in menu/move-size mode, or cursor clipping) that is blocked in a SendMessage to the thread waiting in wait_grab_pointer(). I'd rather not cap the wait at one second though. The wait exists so WM_ACTIVATE is delayed while the window manager is moving or resizing the window (42c2128), and a title bar drag regularly takes longer than a second, so the cap brings back the stale-clip-rect problem that commit fixed. Could you instead stop waiting when the thread has a sent message pending? Something like: before the NtDelayExecution(). That breaks the deadlock on the first retry instead of after a second, and leaves the WM move/resize case alone. NtUserGetQueueStatus() calls back into ProcessEvents, but nested event processing is already disabled while an event is being handled, so it's safe from there. If that fixes Endfield for you I'm happy to merge it. |
|
Thanks for tracking this down, merged! The deadlock is real: winex11 itself can hold the grab from another thread (capture in menu/move-size mode, or cursor clipping) while that thread is blocked in a SendMessage to the one waiting in wait_grab_pointer(). I changed one thing in a follow-up commit: instead of giving up after one second, the wait now stops as soon as the thread has a sent message pending ( |
…ange
wait_grab_pointer() retries XGrabPointer() every 10ms until it succeeds. That never happens when the grab is held by another thread of the same process that is blocked in a synchronous SendMessage() to the thread changing focus: the sender cannot release the grab before its message is processed, and the receiver cannot process the message before the grab is released.
Bound the wait to one second so that the pending message can be processed and the grab released. The patch has the reproduction details.