Don't die when last window either.

This commit is contained in:
Nicholas Marriott 2009-01-17 17:36:55 +00:00
parent 1237025d99
commit f3edf28b7c
1 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: server.c,v 1.104 2009-01-16 00:12:58 nicm Exp $ */ /* $Id: server.c,v 1.105 2009-01-17 17:36:55 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -193,6 +193,8 @@ server_main(const char *srv_path, int srv_fd)
last = time(NULL); last = time(NULL);
sigterm=1;/*XXX*/
pfds = NULL; pfds = NULL;
while (!sigterm) { while (!sigterm) {
/* Initialise pollfd array. */ /* Initialise pollfd array. */
@ -600,6 +602,10 @@ server_handle_client(struct client *c)
while (tty_keys_next(&c->tty, &key) == 0) { while (tty_keys_next(&c->tty, &key) == 0) {
server_activity = time(NULL); server_activity = time(NULL);
if (c->session == NULL)
return;
wp = c->session->curw->window->active; /* could die - do each loop */
server_clear_client_message(c); server_clear_client_message(c);
if (c->prompt_string != NULL) { if (c->prompt_string != NULL) {
status_prompt_key(c, key); status_prompt_key(c, key);
@ -607,7 +613,6 @@ server_handle_client(struct client *c)
} }
if (server_locked) if (server_locked)
continue; continue;
wp = c->session->curw->window->active; /* could die - do each loop */
/* No previous prefix key. */ /* No previous prefix key. */
if (!(c->flags & CLIENT_PREFIX)) { if (!(c->flags & CLIENT_PREFIX)) {
@ -657,6 +662,8 @@ server_handle_client(struct client *c)
/* Dispatch the command. */ /* Dispatch the command. */
key_bindings_dispatch(bd, c); key_bindings_dispatch(bd, c);
} }
if (c->session == NULL)
return;
wp = c->session->curw->window->active; /* could die - do each loop */ wp = c->session->curw->window->active; /* could die - do each loop */
/* Ensure the cursor is in the right place and correctly on or off. */ /* Ensure the cursor is in the right place and correctly on or off. */