diff options
Diffstat (limited to 'src/clients/mod.rs')
-rw-r--r-- | src/clients/mod.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/clients/mod.rs b/src/clients/mod.rs index d07de74..70e3798 100644 --- a/src/clients/mod.rs +++ b/src/clients/mod.rs @@ -94,7 +94,9 @@ impl WM<'_> { pub(crate) fn handle_unmap_notify(&mut self, e: &UnmapNotifyEvent) -> Result<()> { if let Some(c) = self.clients.find_client_mut(e.window()) { if e.is_from_send_event() { - c.set_withdrawn(&self.conn, true); + let cookie = c.set_withdrawn(&self.conn, true); + // The above may fail if the window has already been destroyed - just discard the error here. + let _ = self.conn.check_request(cookie); } else { self.clients.unmanage(&self.conn, e.window(), false); } @@ -237,9 +239,12 @@ impl ClientState { let c = self.mons[mon].clients.remove(i); if !already_destroyed { - c.set_event_mask(conn, EventMask::empty()); + c.set_event_mask(conn, EventMask::NO_EVENT); // TODO: Ungrab button - c.set_withdrawn(conn, true); + let cookie = c.set_withdrawn(conn, true); + + // If any of the above requests fail, it's just a race condition and the window is already destroyed, so discard the error here. + let _ = conn.check_request(cookie); } self.rearrange(conn); } |