1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

window: wayland: fix segfault on shutdown

This commit is contained in:
Wez Furlong 2019-11-30 17:35:58 -08:00
parent c1fc335115
commit 1960655915

View File

@ -22,17 +22,25 @@ use toolkit::reexports::client::{Display, EventQueue};
use toolkit::Environment; use toolkit::Environment;
pub struct WaylandConnection { pub struct WaylandConnection {
pub(crate) display: RefCell<Display>,
event_q: RefCell<EventQueue>,
pub(crate) environment: RefCell<Environment>,
should_terminate: RefCell<bool>, should_terminate: RefCell<bool>,
timers: RefCell<TimerList>, timers: RefCell<TimerList>,
pub(crate) tasks: Tasks, pub(crate) tasks: Tasks,
pub(crate) next_window_id: AtomicUsize, pub(crate) next_window_id: AtomicUsize,
pub(crate) windows: RefCell<HashMap<usize, Rc<RefCell<WaylandWindowInner>>>>, pub(crate) windows: RefCell<HashMap<usize, Rc<RefCell<WaylandWindowInner>>>>,
pub(crate) seat: WlSeat,
pub(crate) keyboard: KeyboardDispatcher, // Take care with the destruction order: the underlying wayland
// libraries are not safe and require destruction in reverse
// creation order. This list of fields must reflect that otherwise
// we'll segfault on shutdown.
// Rust guarantees that struct fields are dropped in the order
// they appear in the struct, so the Display must be at the
// bottom of this list.
pub(crate) pointer: PointerDispatcher, pub(crate) pointer: PointerDispatcher,
pub(crate) keyboard: KeyboardDispatcher,
pub(crate) seat: WlSeat,
pub(crate) environment: RefCell<Environment>,
event_q: RefCell<EventQueue>,
pub(crate) display: RefCell<Display>,
} }
impl Evented for WaylandConnection { impl Evented for WaylandConnection {