From 64d815a1766db69aabedc74069cef9b6c134f42f Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 18 Jun 2024 15:22:26 +0200 Subject: [PATCH] linux/x11: Fix closing of GPUI windows not working (#13201) This fixes everything but the main Zed window (GPUI examples, prompt library, etc.) not being closable by clicking on the X in X11. We had a dangling reference before: we would remove the window from the X11 state, but GPUI itself would still have the window in its references. In order to fix this we have to call `window.close()`, which ends up calling `cx.remove_window()`, which removes the reference. That in turn then causes the reference to be dropped, which cleans up the X11 state for the window. Release Notes: - N/A --- crates/gpui/src/platform/linux/x11/client.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs index 2e9add68da67f07c68be53292730b5d9d9da6725..05e20b5d8a3f74d0a5f62c2605d750e8402bb1c9 100644 --- a/crates/gpui/src/platform/linux/x11/client.rs +++ b/crates/gpui/src/platform/linux/x11/client.rs @@ -475,9 +475,8 @@ impl X11Client { if atom == state.atoms.WM_DELETE_WINDOW { // window "x" button clicked by user if window.should_close() { - let window_ref = state.windows.remove(&event.window)?; - state.loop_handle.remove(window_ref.refresh_event_token); // Rest of the close logic is handled in drop_window() + window.close(); } } }