state: Don't crash on error due to missing logger

This commit is contained in:
Victoria Brekenfeld 2022-12-05 23:20:32 +01:00
parent 74cec7bdd6
commit fc04ef2157
2 changed files with 3 additions and 12 deletions

View file

@ -27,7 +27,7 @@ pub mod debug;
fn main() -> Result<()> {
// setup logger
let log = logger::init_logger()?;
let _log = logger::init_logger()?;
slog_scope::info!("Cosmic starting up!");
// init event loop
@ -41,7 +41,6 @@ fn main() -> Result<()> {
socket,
event_loop.handle(),
event_loop.get_signal(),
log,
);
// init backend
backend::init_backend_auto(&display.handle(), &mut event_loop, &mut state)?;
@ -71,9 +70,9 @@ fn main() -> Result<()> {
let _ = data.display.flush_clients();
})?;
let _log = data.state.destroy();
// drop eventloop before logger
// drop eventloop & state before logger
std::mem::drop(event_loop);
std::mem::drop(data);
Ok(())
}

View file

@ -3,7 +3,6 @@
use crate::{
backend::{kms::KmsState, winit::WinitState, x11::X11State},
config::{Config, OutputConfig},
logger::LogState,
shell::Shell,
utils::prelude::*,
wayland::protocols::{
@ -85,7 +84,6 @@ pub struct Common {
pub clock: Clock<Monotonic>,
pub should_stop: bool,
pub log: LogState,
#[cfg(feature = "debug")]
pub egui: Egui,
@ -207,7 +205,6 @@ impl State {
socket: OsString,
handle: LoopHandle<'static, Data>,
signal: LoopSignal,
log: LogState,
) -> State {
let clock = Clock::new().expect("Failed to initialize clock");
let config = Config::load();
@ -251,7 +248,6 @@ impl State {
clock,
should_stop: false,
log,
#[cfg(feature = "debug")]
egui: Egui { active: false },
@ -313,10 +309,6 @@ impl State {
privileged: true,
}
}
pub fn destroy(self) -> LogState {
self.common.log
}
}
impl Common {