Skip to content

Issues with Window::request_redraw() on X11 #1193

@JohnDoneth

Description

@JohnDoneth

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions