The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(window): stop the app panicking when windows close and open together (#2124)
l0ng-ai4d968a2aca65
diff --git a/src-tauri/src/titlebar.rs b/src-tauri/src/titlebar.rsindex d79a75523..58eb68019 100644--- a/src-tauri/src/titlebar.rs+++ b/src-tauri/src/titlebar.rs@@ -89,7 +89,12 @@ fn track(window: &NSWindow, app: &tauri::AppHandle) -> Tracked {crate::macos::hide_tab_bar(&window);}// The web title bar releases the room kept for the window buttons in full screen.- app.state::<crate::state::AppState>().sink.emit(ide_core::IdeEvent::WindowFullscreenChanged);+ // Closing a window posts this while the runtime still holds its window table, and an+ // emit from here evaluates script in that table; send it from outside the notification.+ let app = app.clone();+ tauri::async_runtime::spawn(async move {+ app.state::<crate::state::AppState>().sink.emit(ide_core::IdeEvent::WindowFullscreenChanged);+ });});let observer = unsafe {NSNotificationCenter::defaultCenter().addObserverForName_object_queue_usingBlock(diff --git a/src-tauri/src/windows.rs b/src-tauri/src/windows.rsindex fd9c9fd26..97c1ffbd9 100644--- a/src-tauri/src/windows.rs+++ b/src-tauri/src/windows.rs@@ -286,6 +286,9 @@ pub fn settings_label(parent: &str) -> String {format!("{}-{parent}", AuxKind::Settings.name())}+/// Held from choosing a project window's label until the window exists.+static CREATING: Mutex<()> = Mutex::new(());+/// Windows being built to join a window group, which takes their frame from the group.#[cfg(target_os = "macos")]static JOINING_GROUP: Mutex<Vec<String>> = Mutex::new(Vec::new());@@ -665,6 +668,8 @@ fn create_window_for() -> IdeResult<WebviewWindow> {#[cfg(target_os = "macos")]let tab_target = if _restoring { None } else { crate::macos::new_project_tab_target(app, &launch)? };+ // The label is free only until the window exists, so concurrent opens take turns.+ let creating = CREATING.lock();let windows = app.webview_windows();let label = next_label(windows.keys().map(String::as_str));let mut config = window_config(app)?;@@ -691,6 +696,7 @@ fn create_window_for(config.visible = false;}let window = build_project_window(app, config);+ drop(creating);// Plugins hear of the window from the main thread's queue; forget it after them.#[cfg(target_os = "macos")]if tab_target.is_some() {