diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-06-14 21:35:30 +0300 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-06-15 01:04:46 +0300 |
| commit | 3255037b250e85d5714d4398f42b14681ee26d75 (patch) | |
| tree | 28593e070e5e824e20f575085ffa21a14075f2a1 | |
| parent | d2ae9aba80da04bfbef2bf8f703e244236caed17 (diff) | |
bugfix: null dereference in removeclient() caused freezes -- fixes #9
this fixes freezes caused by clients opened in another
empty desktop and closed without ever being focused.
this possibly hides another bug, where new clients that
spawn on other desktops that are not followed do not
become the current clients.
reports by djura-sans/kuraku, TheLemonMan, Shinryuu. ref:
https://bbs.archlinux.org/viewtopic.php?id=132122&p=27
https://bbs.archlinux.org/viewtopic.php?pid=1116092#p1116092
| -rw-r--r-- | monsterwm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/monsterwm.c b/monsterwm.c index 82d8db9..734a111 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -642,9 +642,9 @@ void quit(void) { /* remove the specified client * - * note, the removing client can be on any desktop, - * we must return back to the current focused desktop. - * if c was the previously focused, prevfocus must be updated + * note: the removing client can be on any desktop! + * we must always return back to the current focused desktop + * if c was ther prevfocus client, prevfocus must be updated * else if c was the current one, current must be updated. */ void removeclient(client *c) { client **p = NULL; @@ -653,7 +653,7 @@ void removeclient(client *c) { for (select_desktop(nd), p = &head; *p && !(found = *p == c); p = &(*p)->next); *p = c->next; if (c == prevfocus) prevfocus = prev_client(current); - if (c == current || !head->next) update_current(prevfocus); + if (c == current || (head && !head->next)) update_current(prevfocus); free(c); c = NULL; if (cd == nd -1) tile(); else select_desktop(cd); } |
