From e8e4d4ce6643e51b913c904ed092bc18288c08e9 Mon Sep 17 00:00:00 2001 From: Murarth <murarth@gmail.com> Date: Tue, 16 Jul 2019 15:53:41 -0700 Subject: [PATCH] X11: Fix `request_redraw` deadlock while handling `RedrawRequested` (#1046) --- src/platform_impl/linux/x11/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platform_impl/linux/x11/mod.rs b/src/platform_impl/linux/x11/mod.rs index bbd962c5..45220f8b 100644 --- a/src/platform_impl/linux/x11/mod.rs +++ b/src/platform_impl/linux/x11/mod.rs @@ -278,8 +278,10 @@ impl<T: 'static> EventLoop<T> { } // Empty the redraw requests { - let mut guard = wt.pending_redraws.lock().unwrap(); - for wid in guard.drain() { + // Release the lock to prevent deadlock + let windows: Vec<_> = wt.pending_redraws.lock().unwrap().drain().collect(); + + for wid in windows { sticky_exit_callback( Event::WindowEvent { window_id: crate::window::WindowId(super::WindowId::X(wid)),