Xinqi Bao's Git

Added tag 1.5 for changeset 728c9089b079721b43c3347124639a29baa22a97
[dwm.git] / client.c
index 71ef677..6524c06 100644 (file)
--- a/client.c
+++ b/client.c
@@ -414,19 +414,21 @@ togglemax(Arg *arg)
 void
 unmanage(Client *c)
 {
+       Client *nc;
+
        XGrabServer(dpy);
        XSetErrorHandler(xerrordummy);
 
        detach(c);
+       detachstack(c);
        if(sel == c) {
-               for(sel = stack; sel && !isvisible(sel); sel = sel->snext);
-               focus(sel);
+               for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
+               focus(nc);
        }
 
        XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
        XDestroyWindow(dpy, c->twin);
 
-       detachstack(c);
        free(c->tags);
        free(c);