fix: properly destroy xwayland

This commit is contained in:
Nova
2023-08-06 11:19:42 -04:00
parent 2c3e4bd135
commit 2c979c84c4
2 changed files with 5 additions and 4 deletions

View File

@@ -234,7 +234,7 @@ fn main() {
let mut sleep_duration = Duration::ZERO;
debug_span!("StereoKit").in_scope(|| {
sk.run(
move |sk| {
|sk| {
let _span = debug_span!("StereoKit step");
let _span = _span.enter();
@@ -287,6 +287,8 @@ fn main() {
)
});
#[cfg(feature = "wayland")]
drop(wayland);
let _ = event_stop_tx.send(());
event_thread
.join()

View File

@@ -24,7 +24,6 @@ use smithay::backend::renderer::ImportDma;
use smithay::reexports::wayland_server::backend::ClientId;
use smithay::reexports::wayland_server::DisplayHandle;
use smithay::reexports::wayland_server::{backend::GlobalId, Display, ListeningSocket};
use std::mem::ManuallyDrop;
use std::os::fd::OwnedFd;
use std::os::unix::prelude::AsRawFd;
use std::{
@@ -91,7 +90,7 @@ pub struct Wayland {
dmabuf_rx: UnboundedReceiver<Dmabuf>,
wayland_state: Arc<Mutex<WaylandState>>,
#[cfg(feature = "xwayland")]
pub xwayland_state: ManuallyDrop<xwayland::XWaylandState>,
pub xwayland_state: xwayland::XWaylandState,
}
impl Wayland {
pub fn new() -> Result<Self> {
@@ -110,7 +109,7 @@ impl Wayland {
let (dmabuf_tx, dmabuf_rx) = mpsc::unbounded_channel();
let display = Arc::new(DisplayWrapper(Mutex::new(display), display_handle.clone()));
#[cfg(feature = "xwayland")]
let xwayland_state = ManuallyDrop::new(xwayland::XWaylandState::create(&display_handle)?);
let xwayland_state = xwayland::XWaylandState::create(&display_handle)?;
let wayland_state = WaylandState::new(display_handle, &renderer, dmabuf_tx);
let (global_destroy_queue_in, global_destroy_queue) = mpsc::channel(8);