Skip to content

Commit 9999f53

Browse files
authored
X11: Fix deadlock when an error occurs during startup (#1475)
1 parent 522a6e3 commit 9999f53

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/platform_impl/linux/mod.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,12 @@ impl<T: 'static> EventLoop<T> {
584584
}
585585

586586
pub fn new_x11_any_thread() -> Result<EventLoop<T>, XNotSupported> {
587-
X11_BACKEND
588-
.lock()
589-
.as_ref()
590-
.map(Arc::clone)
591-
.map(x11::EventLoop::new)
592-
.map(EventLoop::X)
593-
.map_err(|err| err.clone())
587+
let xconn = match X11_BACKEND.lock().as_ref() {
588+
Ok(xconn) => xconn.clone(),
589+
Err(err) => return Err(err.clone()),
590+
};
591+
592+
Ok(EventLoop::X(x11::EventLoop::new(xconn)))
594593
}
595594

596595
#[inline]

0 commit comments

Comments
 (0)