From 0eb9363533f00526b99529dff0cd20addbda4c7e Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 9 Aug 2010 11:51:49 +0200 Subject: [PATCH] Clear our event mask in client_unmanage() This should fix an actual race condition: - Client unmaps its window (UnmapNotify for awesome) - Client maps its window (MapRequest for awesome) - Due to the UnmapNotify: client_unmanage() runs and reparents the window back to the root (ReparentNotify) - Due to the MapRequest: client_manage() runs - Due to the ReparentNotify: We call client_unmanage() again and now the client's window is lost. Signed-off-by: Uli Schlachter --- objects/client.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/objects/client.c b/objects/client.c index 66aa9e1d..87a7f299 100644 --- a/objects/client.c +++ b/objects/client.c @@ -1043,6 +1043,13 @@ client_unmanage(client_t *c) ewmh_update_net_client_list(c->phys_screen); + /* Clear our event mask so that we don't receive any events from now on, + * especially not for the following requests. */ + xcb_change_window_attributes(globalconf.connection, + c->window, + XCB_CW_EVENT_MASK, + (const uint32_t []) { 0 }); + xcb_screen_t *s = xutil_screen_get(globalconf.connection, c->phys_screen); xcb_unmap_window(globalconf.connection, c->window); xcb_reparent_window(globalconf.connection, c->window, s->root,