From 8f4a8efa99eb2e1f7a35c0e3aea57627593639f8 Mon Sep 17 00:00:00 2001 From: John Nunley Date: Wed, 21 Aug 2024 21:14:07 -0700 Subject: [PATCH] m: Ignore mutex poisoning in X11_BACKEND A panic doesn't really put any of the fields in XConnection into an invalid state, so there is no real reason to panic when poisoning is detected. So just ignore the poison. Closes #3870 Signed-off-by: John Nunley --- src/platform_impl/linux/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index 9fbc3e8912..f73157dabd 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -626,7 +626,7 @@ unsafe extern "C" fn x_error_callback( display: *mut x11::ffi::Display, event: *mut x11::ffi::XErrorEvent, ) -> c_int { - let xconn_lock = X11_BACKEND.lock().unwrap(); + let xconn_lock = X11_BACKEND.lock().unwrap_or_else(|e| e.into_inner()); if let Ok(ref xconn) = *xconn_lock { // Call all the hooks. let mut error_handled = false; @@ -748,7 +748,7 @@ impl EventLoop { #[cfg(x11_platform)] fn new_x11_any_thread() -> Result { - let xconn = match X11_BACKEND.lock().unwrap().as_ref() { + let xconn = match X11_BACKEND.lock().unwrap_or_else(|e| e.into_inner()).as_ref() { Ok(xconn) => xconn.clone(), Err(_) => return Err(EventLoopError::NotSupported(NotSupportedError::new())), };