mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-08 09:14:22 +01:00
Free/close windows properly.
This commit is contained in:
parent
ab02144e3d
commit
3859c9f239
15
server.c
15
server.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server.c,v 1.31 2007-10-23 10:25:03 nicm Exp $ */
|
/* $Id: server.c,v 1.32 2007-10-24 11:05:59 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -123,6 +123,7 @@ server_main(char *srv_path, int srv_fd)
|
|||||||
{
|
{
|
||||||
struct pollfd *pfds, *pfd;
|
struct pollfd *pfds, *pfd;
|
||||||
int nfds;
|
int nfds;
|
||||||
|
u_int i;
|
||||||
|
|
||||||
siginit();
|
siginit();
|
||||||
|
|
||||||
@ -174,6 +175,18 @@ server_main(char *srv_path, int srv_fd)
|
|||||||
server_handle_clients(&pfd);
|
server_handle_clients(&pfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||||
|
if (ARRAY_ITEM(&sessions, i) != NULL)
|
||||||
|
session_destroy(ARRAY_ITEM(&sessions, i));
|
||||||
|
}
|
||||||
|
ARRAY_FREE(&sessions);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||||
|
if (ARRAY_ITEM(&clients, i) != NULL)
|
||||||
|
server_lost_client(ARRAY_ITEM(&clients, i));
|
||||||
|
}
|
||||||
|
ARRAY_FREE(&clients);
|
||||||
|
|
||||||
key_bindings_free();
|
key_bindings_free();
|
||||||
|
|
||||||
close(srv_fd);
|
close(srv_fd);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: session.c,v 1.23 2007-10-19 22:16:53 nicm Exp $ */
|
/* $Id: session.c,v 1.24 2007-10-24 11:05:59 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -124,8 +124,11 @@ session_destroy(struct session *s)
|
|||||||
while (!ARRAY_EMPTY(&sessions) && ARRAY_LAST(&sessions) == NULL)
|
while (!ARRAY_EMPTY(&sessions) && ARRAY_LAST(&sessions) == NULL)
|
||||||
ARRAY_TRUNC(&sessions, 1);
|
ARRAY_TRUNC(&sessions, 1);
|
||||||
|
|
||||||
while (!ARRAY_EMPTY(&s->windows))
|
for (i = 0; i < ARRAY_LENGTH(&s->windows); i++) {
|
||||||
window_remove(&s->windows, ARRAY_FIRST(&s->windows));
|
if (ARRAY_ITEM(&s->windows, i) != NULL)
|
||||||
|
window_remove(&s->windows, ARRAY_ITEM(&s->windows, i));
|
||||||
|
}
|
||||||
|
ARRAY_FREE(&s->windows);
|
||||||
|
|
||||||
xfree(s->name);
|
xfree(s->name);
|
||||||
xfree(s);
|
xfree(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user