gpui: Fix crash caused by ownership leak (#19185)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run

- Closes #18811

Release Notes:

- N/A
This commit is contained in:
wannacu 2024-10-15 03:46:04 +08:00 committed by GitHub
parent 6e2869a321
commit 41ba4178fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -675,11 +675,12 @@ impl X11Client {
} }
} }
} else if event.type_ == state.atoms.XdndLeave { } else if event.type_ == state.atoms.XdndLeave {
window.handle_input(PlatformInput::FileDrop(FileDropEvent::Pending { let position = state.xdnd_state.position;
position: state.xdnd_state.position, drop(state);
})); window
.handle_input(PlatformInput::FileDrop(FileDropEvent::Pending { position }));
window.handle_input(PlatformInput::FileDrop(FileDropEvent::Exited {})); 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 { } else if event.type_ == state.atoms.XdndPosition {
if let Ok(pos) = state if let Ok(pos) = state
.xcb_connection .xcb_connection
@ -709,9 +710,10 @@ impl X11Client {
state.xdnd_state.other_window, state.xdnd_state.other_window,
arg4, arg4,
); );
window.handle_input(PlatformInput::FileDrop(FileDropEvent::Pending { let position = state.xdnd_state.position;
position: state.xdnd_state.position, drop(state);
})); window
.handle_input(PlatformInput::FileDrop(FileDropEvent::Pending { position }));
} else if event.type_ == state.atoms.XdndDrop { } else if event.type_ == state.atoms.XdndDrop {
xdnd_send_finished( xdnd_send_finished(
&state.xcb_connection, &state.xcb_connection,
@ -719,10 +721,11 @@ impl X11Client {
event.window, event.window,
state.xdnd_state.other_window, state.xdnd_state.other_window,
); );
window.handle_input(PlatformInput::FileDrop(FileDropEvent::Submit { let position = state.xdnd_state.position;
position: state.xdnd_state.position, drop(state);
})); window
state.xdnd_state = Xdnd::default(); .handle_input(PlatformInput::FileDrop(FileDropEvent::Submit { position }));
self.0.borrow_mut().xdnd_state = Xdnd::default();
} }
} }
Event::SelectionNotify(event) => { Event::SelectionNotify(event) => {
@ -751,8 +754,9 @@ impl X11Client {
position: state.xdnd_state.position, position: state.xdnd_state.position,
paths: crate::ExternalPaths(paths), paths: crate::ExternalPaths(paths),
}); });
drop(state);
window.handle_input(input); window.handle_input(input);
state.xdnd_state.retrieved = true; self.0.borrow_mut().xdnd_state.retrieved = true;
} }
Err(_) => {} Err(_) => {}
} }