Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(desktop): tear down liquid glass during macOS app exit

Richie McIlroy8f7ef59e5163
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index b3e51c09c..f90111697 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -1772,6 +1772,21 @@ async fn cleanup_app_resources_for_exit(app: &AppHandle) {
let started = Instant::now();
log_process_memory_snapshot("exit_cleanup_begin");
+ // Reverse the macOS Liquid Glass private SPI (remove the NSGlassEffectView, restore
+ // window/WKWebView occlusion detection) BEFORE anything else, so a slow camera/ML
+ // shutdown can never starve it. Leaving an occlusion-suppressed private glass view
+ // attached when the process hard-exits can wedge WindowServer on macOS 26 and soft-
+ // restart the user's login session. Bounded so a stuck main thread can't block exit.
+ #[cfg(target_os = "macos")]
+ {
+ let _ = await_exit_step(
+ "teardown_liquid_glass",
+ APP_EXIT_STEP_TIMEOUT,
+ crate::platform::teardown_all_liquid_glass(app),
+ )
+ .await;
+ }
+
export::cancel_all_exports();
power_observer::uninstall(app);
fake_window::cancel_all_fake_window_listeners(app);
@@ -5264,7 +5279,15 @@ fn handle_run_event(_handle: &AppHandle, event: tauri::RunEvent) {
tauri::RunEvent::Exit => {
#[cfg(target_os = "macos")]
{
- warn!("macOS runtime exit reached; forcing process exit");
+ // This arm runs on the AppKit main thread, so reverse the Liquid Glass
+ // SPI inline before the hard _exit. This is the last-chance teardown for
+ // terminal paths that skip cleanup_app_resources_for_exit; touching the
+ // NSWindow/NSView here is safe precisely because we are on main.
+ let torn_down = crate::platform::teardown_all_liquid_glass_on_main(_handle);
+ warn!(
+ windows = torn_down,
+ "macOS runtime exit reached; tore down liquid glass, forcing process exit"
+ );
force_exit(0);
}