diff options
author | tim <tim> | 2020-03-14 16:11:09 +0000 |
---|---|---|
committer | tim <tim> | 2020-03-14 16:11:09 +0000 |
commit | b9213d0a02de1254358a878cf14ee53f4fb4df0d (patch) | |
tree | f268b473288502280409ca17e9c5cd0e7c378bcc | |
parent | 146fa08e4db93bc8910df5280eaab51a4257ceaf (diff) | |
download | cwm-b9213d0a02de1254358a878cf14ee53f4fb4df0d.tar.gz cwm-b9213d0a02de1254358a878cf14ee53f4fb4df0d.tar.xz cwm-b9213d0a02de1254358a878cf14ee53f4fb4df0d.zip |
Revert previous. Causes a crash as reported by Tom Murphy.
-rw-r--r-- | client.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/client.c b/client.c index ea97344..653c0d4 100644 --- a/client.c +++ b/client.c @@ -668,23 +668,21 @@ void client_set_name(struct client_ctx *cc) { struct winname *wn; + char *newname; int i = 0; - free(cc->name); - if (!xu_get_strprop(cc->win, ewmh[_NET_WM_NAME], &cc->name)) - if (!xu_get_strprop(cc->win, XA_WM_NAME, &cc->name)) - cc->name = xstrdup(""); + if (!xu_get_strprop(cc->win, ewmh[_NET_WM_NAME], &newname)) + if (!xu_get_strprop(cc->win, XA_WM_NAME, &newname)) + newname = xstrdup(""); TAILQ_FOREACH(wn, &cc->nameq, entry) { - if (strcmp(wn->name, cc->name) == 0) { + if (strcmp(wn->name, newname) == 0) TAILQ_REMOVE(&cc->nameq, wn, entry); - free(wn->name); - free(wn); - } i++; } + cc->name = newname; wn = xmalloc(sizeof(*wn)); - wn->name = xstrdup(cc->name); + wn->name = xstrdup(newname); TAILQ_INSERT_TAIL(&cc->nameq, wn, entry); /* Garbage collection. */ |