From e6e42891133478c13c4b418a09daa849eff16a3d Mon Sep 17 00:00:00 2001 From: vasilito Date: Mon, 27 Jul 2026 14:35:33 +0900 Subject: [PATCH] redbear-sessiond: emit SeatRemoved on shutdown Completes the SeatNew/SeatRemoved pair from the prior commit. The emit_seat_removed public method was added but not wired to any shutdown path; this commit hooks it into wait_for_shutdown's return path so subscribers (e.g. SDDM's LogindSeatManager) observe seat departure before the D-Bus connection drops. SEAT_PATH is reused from main.rs's existing constant rather than introducing a new placeholder string. --- .../system/redbear-sessiond/source/src/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/local/recipes/system/redbear-sessiond/source/src/main.rs b/local/recipes/system/redbear-sessiond/source/src/main.rs index 8357097b1a..35e5ae8a20 100644 --- a/local/recipes/system/redbear-sessiond/source/src/main.rs +++ b/local/recipes/system/redbear-sessiond/source/src/main.rs @@ -205,6 +205,23 @@ async fn run_daemon() -> Result<(), Box> { control::start_control_socket(runtime.clone(), shutdown_tx.clone()); tokio::spawn(acpi_watcher::watch_and_emit(connection.clone(), runtime.clone())); wait_for_shutdown(shutdown_rx).await?; + // Order: emit before drop so subscribers see SeatRemoved before the bus connection closes. + let seat_id = match runtime.read() { + Ok(runtime) => runtime.seat_id.clone(), + Err(_) => String::from("seat0"), + }; + let seat_path = + match zbus::zvariant::OwnedObjectPath::try_from(SEAT_PATH.to_owned()) { + Ok(p) => p, + Err(_) => { + eprintln!( + "redbear-sessiond: SEAT_PATH constant is not a valid D-Bus path; skipping SeatRemoved" + ); + drop(connection); + return Ok(()); + } + }; + manager_ref.emit_seat_removed(&seat_id, &seat_path).await; drop(connection); return Ok(()); }