Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
wayland: Fix input_handler out of range access (#10724)
Philipp Schaffrath15c4c4a30802
diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rsindex b8417593d61..41bbd09e7e8 100644--- a/crates/gpui/src/platform/linux/wayland/window.rs+++ b/crates/gpui/src/platform/linux/wayland/window.rs@@ -481,13 +481,12 @@ impl WaylandWindowStatePtr {}}if let PlatformInput::KeyDown(event) = input {- let mut state = self.state.borrow_mut();- if let Some(mut input_handler) = state.input_handler.take() {- if let Some(ime_key) = &event.keystroke.ime_key {+ if let Some(ime_key) = &event.keystroke.ime_key {+ let mut state = self.state.borrow_mut();+ if let Some(mut input_handler) = state.input_handler.take() {drop(state);input_handler.replace_text_in_range(None, ime_key);- let mut state = self.state.borrow_mut();- state.input_handler = Some(input_handler);+ self.state.borrow_mut().input_handler = Some(input_handler);}}}