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: crash when switching overlay modes (ObjC exception)

Louis Beaumont336608fd1f56
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index 6ee97b830..4f94d83bd 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -359,16 +359,18 @@ pub fn reset_main_window(app_handle: tauri::AppHandle) {
#[cfg(target_os = "macos")]
{
- // Try panel first, then regular window
+ // Hide the panel and close the webview so the next shortcut press
+ // creates a fresh window with the new mode config.
+ // NOTE: do NOT call window.destroy() on an NSPanel-backed window — it
+ // triggers an ObjC exception ("Rust cannot catch foreign exceptions").
+ // window.close() is safe and removes the webview from Tauri's registry.
let app_clone = app_handle.clone();
let _ = app_handle.run_on_main_thread(move || {
if let Ok(panel) = app_clone.get_webview_panel(label) {
panel.order_out(None);
- // Released when closed
- panel.released_when_closed(true);
}
if let Some(window) = app_clone.get_webview_window(label) {
- let _ = window.destroy();
+ let _ = window.close();
}
});
crate::window_api::reset_to_regular_and_refresh_tray(&app_handle);