Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui_macos: Fix deadlock during re-entrant key status changes (#51035)
João Soares97049a76baaf
diff --git a/crates/gpui_macos/src/window.rs b/crates/gpui_macos/src/window.rsindex b783a4d0831..002c4719f76 100644--- a/crates/gpui_macos/src/window.rs+++ b/crates/gpui_macos/src/window.rs@@ -2113,10 +2113,12 @@ extern "C" fn window_did_change_key_status(this: &Object, selector: Sel, _: id)// in theory, we're not supposed to invoke this method manually but it balances out// the spurious `becomeKeyWindow` event and helps us work around that bug.if selector == sel!(windowDidBecomeKey:) && !is_active {+ let native_window = lock.native_window;+ drop(lock);unsafe {- let _: () = msg_send![lock.native_window, resignKeyWindow];- return;+ let _: () = msg_send![native_window, resignKeyWindow];}+ return;}let executor = lock.foreground_executor.clone();