Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

linux/x11: Mark windows as destroyed after destroy request (#12892)

Thorsten Ballec9e700e7003
diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs
index b91f9e165c7..b542acfbc57 100644
--- a/crates/gpui/src/platform/linux/x11/client.rs
+++ b/crates/gpui/src/platform/linux/x11/client.rs
@@ -458,6 +458,7 @@ impl X11Client {
state
.windows
.get(&win)
+ .filter(|window_reference| !window_reference.window.state.borrow().destroyed)
.map(|window_reference| window_reference.window.clone())
}
diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs
index d5c1846d569..7ebcbfa0324 100644
--- a/crates/gpui/src/platform/linux/x11/window.rs
+++ b/crates/gpui/src/platform/linux/x11/window.rs
@@ -154,6 +154,7 @@ pub struct Callbacks {
}
pub struct X11WindowState {
+ pub destroyed: bool,
client: X11ClientStatePtr,
executor: ForegroundExecutor,
atoms: XcbAtoms,
@@ -368,6 +369,7 @@ impl X11WindowState {
input_handler: None,
appearance,
handle,
+ destroyed: false,
}
}
@@ -394,6 +396,10 @@ impl Drop for X11Window {
.unwrap();
self.0.xcb_connection.flush().unwrap();
+ // Mark window as destroyed so that we can filter out when X11 events
+ // for it still come in.
+ state.destroyed = true;
+
let this_ptr = self.0.clone();
let client_ptr = state.client.clone();
state