Skip to content

Commit

Permalink
X11: Fix deadlock when an error occurs during startup (rust-windowing…
Browse files Browse the repository at this point in the history
  • Loading branch information
murarth authored Feb 19, 2020
1 parent 522a6e3 commit 9999f53
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/platform_impl/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,12 @@ impl<T: 'static> EventLoop<T> {
}

pub fn new_x11_any_thread() -> Result<EventLoop<T>, XNotSupported> {
X11_BACKEND
.lock()
.as_ref()
.map(Arc::clone)
.map(x11::EventLoop::new)
.map(EventLoop::X)
.map_err(|err| err.clone())
let xconn = match X11_BACKEND.lock().as_ref() {
Ok(xconn) => xconn.clone(),
Err(err) => return Err(err.clone()),
};

Ok(EventLoop::X(x11::EventLoop::new(xconn)))
}

#[inline]
Expand Down

0 comments on commit 9999f53

Please sign in to comment.