From 79340e9afda80e0c064163fb07d179e74aa1d142 Mon Sep 17 00:00:00 2001 From: Michael Cardell Widerkrantz Date: Thu, 23 Jun 2011 07:18:28 +0200 Subject: Use freeitem() instead of explicitly freeing from global window list. If a window is unmapped and we are going to forget about it we need to take into consideration if it's currently focused. --- mcwm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mcwm.c b/mcwm.c index 5f1bdbf..13cfcc0 100644 --- a/mcwm.c +++ b/mcwm.c @@ -764,9 +764,8 @@ void forgetclient(struct client *client) /* Delete window from workspace list. */ delfromworkspace(client, curws); - free(client->winitem->data); - - delitem(&winlist, client->winitem); + /* Remove from global window list. */ + freeitem(&winlist, NULL, client->winitem); } /* Forget everything about a client with client->id win. */ @@ -3874,7 +3873,13 @@ void events(void) if (client->id == e->window) { PDEBUG("Forgetting about %d\n", e->window); + if (focuswin == client) + { + focuswin = NULL; + } + forgetclient(client); + break; } } /* for */ -- cgit v1.2.3