From 7e04e30171a1897de468592fe5c1f6082d12eb69 Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Thu, 20 Jun 2024 20:58:41 +0100 Subject: [PATCH] fix(wayland): exit on event dispatch error This should hopefully resolve log spamming issues. --- src/clients/wayland/mod.rs | 5 ++++- src/error.rs | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/clients/wayland/mod.rs b/src/clients/wayland/mod.rs index 8c7fcb8..ca7c367 100644 --- a/src/clients/wayland/mod.rs +++ b/src/clients/wayland/mod.rs @@ -2,8 +2,9 @@ mod macros; mod wl_output; mod wl_seat; -use crate::error::ERR_CHANNEL_RECV; +use crate::error::{ExitCode, ERR_CHANNEL_RECV}; use crate::{arc_mut, lock, register_client, send, spawn, spawn_blocking}; +use std::process::exit; use std::sync::{Arc, Mutex}; use calloop_channel::Event::Msg; @@ -305,6 +306,8 @@ impl Environment { "{:?}", Report::new(err).wrap_err("Failed to dispatch pending wayland events") ); + + exit(ExitCode::WaylandDispatchError as i32) } } } diff --git a/src/error.rs b/src/error.rs index 66f30cd..a55fa12 100644 --- a/src/error.rs +++ b/src/error.rs @@ -3,6 +3,7 @@ pub enum ExitCode { GtkDisplay = 1, CreateBars = 2, IpcResponseError = 3, + WaylandDispatchError = 4, } pub const ERR_MUTEX_LOCK: &str = "Failed to get lock on Mutex";