diff options
author | tim | 2020-03-14 16:11:09 +0000 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-03-18 14:34:16 +0100 |
commit | dd0de3d2b93f228ae00b7b2c38f6dd1e1a0630dc (patch) | |
tree | cc60b4bae439f1327de6898c47ba137e7434c226 /client.c | |
parent | f08098ca19ce005a9ceb5d5205c23db99d904187 (diff) | |
download | cwm-dd0de3d2b93f228ae00b7b2c38f6dd1e1a0630dc.tar.gz |
Revert previous. Causes a crash as reported by Tom Murphy.
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.259 2020/03/13 20:49:13 tim Exp $ + * $OpenBSD: client.c,v 1.260 2020/03/14 16:11:09 tim Exp $ */ #include <sys/types.h> @@ -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. */ |