main: Fix crash on shutdown

This commit is contained in:
Victoria Brekenfeld 2022-03-16 19:47:39 +01:00
parent a0e0f5a1d3
commit 373eed4ac5
2 changed files with 9 additions and 1 deletions

View file

@ -60,6 +60,10 @@ fn main() -> Result<()> {
state.common.spaces.refresh(); state.common.spaces.refresh();
})?; })?;
let _log = state.destroy();
// drop eventloop before logger
std::mem::drop(event_loop);
Ok(()) Ok(())
} }

View file

@ -30,8 +30,8 @@ use std::{
use std::{collections::VecDeque, time::Duration}; use std::{collections::VecDeque, time::Duration};
pub struct State { pub struct State {
pub common: Common,
pub backend: BackendData, pub backend: BackendData,
pub common: Common,
} }
pub struct Common { pub struct Common {
@ -195,6 +195,10 @@ impl State {
backend: BackendData::Unset, backend: BackendData::Unset,
} }
} }
pub fn destroy(self) -> LogState {
self.common.log
}
} }
#[cfg(feature = "debug")] #[cfg(feature = "debug")]