Wayland: Fix segfault when exiting with ctrl+q
(#11324)
Release Notes: - N/A When closing with `ctrl-q`, drop_window is not called and results in a segfault.
This commit is contained in:
parent
b58bf64f0a
commit
7bc1025d91
1 changed files with 20 additions and 12 deletions
|
@ -199,9 +199,22 @@ impl WaylandClientStatePtr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if state.windows.is_empty() {
|
if state.windows.is_empty() {
|
||||||
|
state.common.signal.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct WaylandClient(Rc<RefCell<WaylandClientState>>);
|
||||||
|
|
||||||
|
impl Drop for WaylandClient {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
let mut state = self.0.borrow_mut();
|
||||||
|
state.windows.clear();
|
||||||
|
|
||||||
// Drop the clipboard to prevent a seg fault after we've closed all Wayland connections.
|
// Drop the clipboard to prevent a seg fault after we've closed all Wayland connections.
|
||||||
state.clipboard = None;
|
|
||||||
state.primary = None;
|
state.primary = None;
|
||||||
|
state.clipboard = None;
|
||||||
if let Some(wl_pointer) = &state.wl_pointer {
|
if let Some(wl_pointer) = &state.wl_pointer {
|
||||||
wl_pointer.release();
|
wl_pointer.release();
|
||||||
}
|
}
|
||||||
|
@ -211,14 +224,9 @@ impl WaylandClientStatePtr {
|
||||||
if let Some(data_device) = &state.data_device {
|
if let Some(data_device) = &state.data_device {
|
||||||
data_device.release();
|
data_device.release();
|
||||||
}
|
}
|
||||||
state.common.signal.stop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct WaylandClient(Rc<RefCell<WaylandClientState>>);
|
|
||||||
|
|
||||||
const WL_DATA_DEVICE_MANAGER_VERSION: u32 = 3;
|
const WL_DATA_DEVICE_MANAGER_VERSION: u32 = 3;
|
||||||
const WL_OUTPUT_VERSION: u32 = 2;
|
const WL_OUTPUT_VERSION: u32 = 2;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue