state: Don't crash on error due to missing logger
This commit is contained in:
parent
74cec7bdd6
commit
fc04ef2157
2 changed files with 3 additions and 12 deletions
|
|
@ -27,7 +27,7 @@ pub mod debug;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
// setup logger
|
// setup logger
|
||||||
let log = logger::init_logger()?;
|
let _log = logger::init_logger()?;
|
||||||
slog_scope::info!("Cosmic starting up!");
|
slog_scope::info!("Cosmic starting up!");
|
||||||
|
|
||||||
// init event loop
|
// init event loop
|
||||||
|
|
@ -41,7 +41,6 @@ fn main() -> Result<()> {
|
||||||
socket,
|
socket,
|
||||||
event_loop.handle(),
|
event_loop.handle(),
|
||||||
event_loop.get_signal(),
|
event_loop.get_signal(),
|
||||||
log,
|
|
||||||
);
|
);
|
||||||
// init backend
|
// init backend
|
||||||
backend::init_backend_auto(&display.handle(), &mut event_loop, &mut state)?;
|
backend::init_backend_auto(&display.handle(), &mut event_loop, &mut state)?;
|
||||||
|
|
@ -71,9 +70,9 @@ fn main() -> Result<()> {
|
||||||
let _ = data.display.flush_clients();
|
let _ = data.display.flush_clients();
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let _log = data.state.destroy();
|
// drop eventloop & state before logger
|
||||||
// drop eventloop before logger
|
|
||||||
std::mem::drop(event_loop);
|
std::mem::drop(event_loop);
|
||||||
|
std::mem::drop(data);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::{kms::KmsState, winit::WinitState, x11::X11State},
|
backend::{kms::KmsState, winit::WinitState, x11::X11State},
|
||||||
config::{Config, OutputConfig},
|
config::{Config, OutputConfig},
|
||||||
logger::LogState,
|
|
||||||
shell::Shell,
|
shell::Shell,
|
||||||
utils::prelude::*,
|
utils::prelude::*,
|
||||||
wayland::protocols::{
|
wayland::protocols::{
|
||||||
|
|
@ -85,7 +84,6 @@ pub struct Common {
|
||||||
pub clock: Clock<Monotonic>,
|
pub clock: Clock<Monotonic>,
|
||||||
pub should_stop: bool,
|
pub should_stop: bool,
|
||||||
|
|
||||||
pub log: LogState,
|
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
pub egui: Egui,
|
pub egui: Egui,
|
||||||
|
|
||||||
|
|
@ -207,7 +205,6 @@ impl State {
|
||||||
socket: OsString,
|
socket: OsString,
|
||||||
handle: LoopHandle<'static, Data>,
|
handle: LoopHandle<'static, Data>,
|
||||||
signal: LoopSignal,
|
signal: LoopSignal,
|
||||||
log: LogState,
|
|
||||||
) -> State {
|
) -> State {
|
||||||
let clock = Clock::new().expect("Failed to initialize clock");
|
let clock = Clock::new().expect("Failed to initialize clock");
|
||||||
let config = Config::load();
|
let config = Config::load();
|
||||||
|
|
@ -251,7 +248,6 @@ impl State {
|
||||||
clock,
|
clock,
|
||||||
should_stop: false,
|
should_stop: false,
|
||||||
|
|
||||||
log,
|
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
egui: Egui { active: false },
|
egui: Egui { active: false },
|
||||||
|
|
||||||
|
|
@ -313,10 +309,6 @@ impl State {
|
||||||
privileged: true,
|
privileged: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn destroy(self) -> LogState {
|
|
||||||
self.common.log
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Common {
|
impl Common {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue