Platform
Platform: Linux with X11. The same code works on Windows.
Issue
Calling Window::request_redraw() at all while handling EventsCleared causes an event stalling issue where events are very delayed.
Calling Window::request_redraw() while handling RedrawRequested freezes the program. Fixed by winit PR 1046
- Calling
Window::request_redraw() causes a large delay in event processing.
Possible Cause
I'm unsure if the issues are related but I believe I found the cause to the second issue and I believe it to be a deadlock on a Mutex. The implementation of EventLoop's has a Mutex field called pending_redraws that is locked when dispatching RedrawRequested events. Because of this when I try and request a redraw after the frame is over during the RedrawRequested event handler, the Mutex is still locked and a deadlock occurs when trying to acquire it as Window::request_redraw tries to do so.
https://github.com/rust-windowing/winit/blob/master/src/platform_impl/linux/x11/mod.rs#L281
https://github.com/rust-windowing/winit/blob/master/src/platform_impl/linux/x11/window.rs#L1288
Platform
Platform: Linux with X11. The same code works on Windows.
Issue
CallingWindow::request_redraw()at all while handlingEventsClearedcauses an event stalling issue where events are very delayed.CallingFixed by winit PR 1046Window::request_redraw()while handlingRedrawRequestedfreezes the program.Window::request_redraw()causes a large delay in event processing.Possible Cause
I'm unsure if the issues are related but I believe I found the cause to the second issue and I believe it to be a deadlock on aMutex. The implementation ofEventLoop's has aMutexfield calledpending_redrawsthat is locked when dispatchingRedrawRequestedevents. Because of this when I try and request a redraw after the frame is over during theRedrawRequestedevent handler, theMutexis still locked and a deadlock occurs when trying to acquire it asWindow::request_redrawtries to do so.https://github.com/rust-windowing/winit/blob/master/src/platform_impl/linux/x11/mod.rs#L281https://github.com/rust-windowing/winit/blob/master/src/platform_impl/linux/x11/window.rs#L1288