fix: properly destroy xwayland

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

View File

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

View File

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