gpui_linux: Release X11 client state before close callback (#63089)
Release Notes: - Fixed double-lease panic on X11 when reacting to WM_DELETE_WINDOW event.
This commit is contained in:
1 parent
9f05be81f9
commit
9d3ee5bffd
1 file changed
+12
-8
@@ -820,15 +820,19 @@ impl X11Client {
|
||||
Event::ClientMessage(event) => {
|
||||
let window = self.get_window(event.window)?;
|
||||
let [atom, arg1, arg2, arg3, arg4] = event.data.as_data32();
|
||||
let mut state = self.0.borrow_mut();
|
||||
let delete_window_atom = self.0.borrow().atoms.WM_DELETE_WINDOW;
|
||||
|
||||
if atom == state.atoms.WM_DELETE_WINDOW && window.should_close() {
|
||||
// window "x" button clicked by user
|
||||
// Rest of the close logic is handled in drop_window()
|
||||
drop(state);
|
||||
window.close();
|
||||
state = self.0.borrow_mut();
|
||||
} else if atom == state.atoms._NET_WM_SYNC_REQUEST {
|
||||
if atom == delete_window_atom {
|
||||
if window.should_close() {
|
||||
// window "x" button clicked by user
|
||||
// Rest of the close logic is handled in drop_window()
|
||||
window.close();
|
||||
}
|
||||
return Some(());
|
||||
}
|
||||
|
||||
let mut state = self.0.borrow_mut();
|
||||
if atom == state.atoms._NET_WM_SYNC_REQUEST {
|
||||
window.state.borrow_mut().last_sync_counter =
|
||||
Some(x11rb::protocol::sync::Int64 {
|
||||
lo: arg2,
|
||||
|
||||
Reference in new issue
Block a user