From d78c9a27fd0ca7923acc0ce741896d0ed322a48c Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sat, 22 Aug 2026 21:20:48 +0200 Subject: [PATCH] Exit desktop process immediately after window close window.run() returning unwinds through main, which races a still-live zbus/keyring background thread's TLS teardown and aborts with "thread local ... during or after destruction". Skip that unwind with a hard exit once the run succeeds; dr_ui::run itself is left alone since the Android entry point also calls it and must not be exited. Co-Authored-By: Claude Sonnet 5 --- apps/darkroom-desktop/src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/darkroom-desktop/src/main.rs b/apps/darkroom-desktop/src/main.rs index d5b983f..05713c8 100644 --- a/apps/darkroom-desktop/src/main.rs +++ b/apps/darkroom-desktop/src/main.rs @@ -17,5 +17,12 @@ fn main() -> anyhow::Result<()> { eprintln!("usage: darkroom-desktop ..."); } - dr_ui::run(paths) + dr_ui::run(paths)?; + + // Skip Rust's normal static/thread-local teardown on the way out: a + // background zbus/keyring connection opened by dr_ui::launch_ui can + // still be alive here, and unwinding through it races its async-io + // reactor thread, panicking with "thread local ... during or after + // destruction" when the window is closed. + std::process::exit(0); }