c->window = NULL;
LIST_REMOVE(Context, by_window, w->contexts, c);
- if (!w->contexts) {
+ if (!w->contexts && !w->keep_always) {
/* Not used anymore? */
LIST_PREPEND(Window, unused, c->cache->unused, w);
if (!c->cache->last_unused)
context_detach_window(c);
- if (!w->contexts) {
+ if (w->in_unused) {
/* Used again? */
LIST_REMOVE(Window, unused, c->cache->unused, w);
if (!c->cache->last_unused)