Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: use _exit() to prevent ggml Metal destructor crash on quit

Louis Beaumont7ffdd4f1ce48
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
index 42ed61962..df95e72f3 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
@@ -549,6 +549,18 @@ fn handle_menu_event(app_handle: &AppHandle, event: tauri::menu::MenuEvent) {
debug!("No recording running to stop");
}
}
+ info!("All tasks stopped, exiting process");
+ // Use _exit() instead of exit() to skip C++ atexit/static destructors.
+ // The whisper/ggml Metal GPU context registers a global destructor that
+ // asserts during teardown (ggml_metal_rsets_free), causing SIGABRT.
+ // We've already done our own cleanup above, so atexit handlers have
+ // nothing useful left to do.
+ #[cfg(unix)]
+ {
+ extern "C" { fn _exit(status: i32) -> !; }
+ unsafe { _exit(0); }
+ }
+ #[cfg(not(unix))]
app_handle_clone.exit(0);
});
}