Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Fix crash caused by ownership leak (#19185)
wannacu41ba4178fcfa
diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rsindex b5a5a00910b..d18bc4b2777 100644--- a/crates/gpui/src/platform/linux/x11/client.rs+++ b/crates/gpui/src/platform/linux/x11/client.rs@@ -675,11 +675,12 @@ impl X11Client {}}} else if event.type_ == state.atoms.XdndLeave {- window.handle_input(PlatformInput::FileDrop(FileDropEvent::Pending {- position: state.xdnd_state.position,- }));+ let position = state.xdnd_state.position;+ drop(state);+ window+ .handle_input(PlatformInput::FileDrop(FileDropEvent::Pending { position }));window.handle_input(PlatformInput::FileDrop(FileDropEvent::Exited {}));- state.xdnd_state = Xdnd::default();+ self.0.borrow_mut().xdnd_state = Xdnd::default();} else if event.type_ == state.atoms.XdndPosition {if let Ok(pos) = state.xcb_connection@@ -709,9 +710,10 @@ impl X11Client {state.xdnd_state.other_window,arg4,);- window.handle_input(PlatformInput::FileDrop(FileDropEvent::Pending {- position: state.xdnd_state.position,- }));+ let position = state.xdnd_state.position;+ drop(state);+ window+ .handle_input(PlatformInput::FileDrop(FileDropEvent::Pending { position }));} else if event.type_ == state.atoms.XdndDrop {xdnd_send_finished(&state.xcb_connection,@@ -719,10 +721,11 @@ impl X11Client {event.window,state.xdnd_state.other_window,);- window.handle_input(PlatformInput::FileDrop(FileDropEvent::Submit {- position: state.xdnd_state.position,- }));- state.xdnd_state = Xdnd::default();+ let position = state.xdnd_state.position;+ drop(state);+ window+ .handle_input(PlatformInput::FileDrop(FileDropEvent::Submit { position }));+ self.0.borrow_mut().xdnd_state = Xdnd::default();}}Event::SelectionNotify(event) => {@@ -751,8 +754,9 @@ impl X11Client {position: state.xdnd_state.position,paths: crate::ExternalPaths(paths),});+ drop(state);window.handle_input(input);- state.xdnd_state.retrieved = true;+ self.0.borrow_mut().xdnd_state.retrieved = true;}Err(_) => {}}