From 0ff0f27e222633c97ba4291f6b9be4137002ca84 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Mon, 21 Sep 2026 00:29:45 +0300 Subject: fix: preserve session layouts across shutdown and restore failures (#4400) * fix: preserve session layouts across shutdown and restore failures refs #4320 * test: update subscription fixture for pane restore errors --------- Co-authored-by: JJ Liebig --- src/platform/mod.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/platform/mod.rs') diff --git a/src/platform/mod.rs b/src/platform/mod.rs index 2ba3e6f3..488c5bee 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -3,6 +3,36 @@ //! Centralizes OS-dependent behavior behind a clean boundary so core //! modules don't scatter `#[cfg]` branches through product logic. +pub(crate) struct HostShutdownMonitor { + task: Option>, +} + +impl HostShutdownMonitor { + pub(crate) fn start( + requested: std::sync::Arc, + wake: impl Fn() + Send + Sync + 'static, + ) -> Self { + let task = monitor_host_shutdown(requested, wake); + Self { task } + } +} + +impl Drop for HostShutdownMonitor { + fn drop(&mut self) { + if let Some(task) = self.task.take() { + task.abort(); + } + } +} + +#[cfg(not(target_os = "linux"))] +fn monitor_host_shutdown( + _requested: std::sync::Arc, + _wake: impl Fn() + Send + Sync + 'static, +) -> Option> { + None +} + #[derive(Debug, Clone, PartialEq, Eq)] pub struct ForegroundProcess { pub pid: u32, -- cgit v1.2.3