This changeset is not released, but it introduced a bug and it have not
fixed for a month.
The problem is that when you call `focus(lastsel)` from `unmanage`
there is a possibility that lastsel is NULL. In this case `focus` first
first checks `if (!c)` on line 390 and sets `c` to `sel` (line 391).
Then it sets `sel` to `c` (line 404 (YARLY)). So after `focus` exits,
`sel` is the window we have just unmanaged, so if you press C-q again,
XKillClient will try to remove window again and fail. Even worse,
`sel` is already freed.
I have tried to fix it by removing
if (!c)
c = sel ? sel : clients;
but it fails.
Adding
if (!lastsel)
sel = NULL;
before `focus(lastsel)` fixes the problem but it is still buggy.
So I want to ask: what should focus(NULL) do? What it means? I can
search where it is called, but I can't understand what it means.
"Focus selected client if something is selected of first client if
nothing is selected or don't focus anything if there is no clients"
don't sound simple.