From 373eed4ac59d90d02d3c647308317e1d4aaaba17 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Wed, 16 Mar 2022 19:47:39 +0100 Subject: [PATCH] main: Fix crash on shutdown --- src/main.rs | 4 ++++ src/state.rs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 08d8401c..a82ca5cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,6 +60,10 @@ fn main() -> Result<()> { state.common.spaces.refresh(); })?; + let _log = state.destroy(); + // drop eventloop before logger + std::mem::drop(event_loop); + Ok(()) } diff --git a/src/state.rs b/src/state.rs index de9bacb9..c8cfcfd1 100644 --- a/src/state.rs +++ b/src/state.rs @@ -30,8 +30,8 @@ use std::{ use std::{collections::VecDeque, time::Duration}; pub struct State { - pub common: Common, pub backend: BackendData, + pub common: Common, } pub struct Common { @@ -195,6 +195,10 @@ impl State { backend: BackendData::Unset, } } + + pub fn destroy(self) -> LogState { + self.common.log + } } #[cfg(feature = "debug")]