diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-10-27 23:27:26 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-10-27 23:27:26 +0000 |
commit | da1f6fc2c8477c99e986061bcdd7c3e854a60076 (patch) | |
tree | f5934e2f96c43f80bad7e3a219230d6337c9d208 /session.c | |
parent | 147b5ae5145dc29e9bf4d0ebbc635939b6fdc60b (diff) | |
parent | 44657bf932b068aff5ce1019a4e8a2e7b00b5321 (diff) | |
download | rtmux-da1f6fc2c8477c99e986061bcdd7c3e854a60076.tar.gz rtmux-da1f6fc2c8477c99e986061bcdd7c3e854a60076.tar.bz2 rtmux-da1f6fc2c8477c99e986061bcdd7c3e854a60076.zip |
Merge branch 'obsd-master'
Conflicts:
Makefile
client.c
server-client.c
server.c
tmux.c
tmux.h
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -119,10 +119,10 @@ session_create(const char *name, int argc, char **argv, const char *path, TAILQ_INIT(&s->lastw); RB_INIT(&s->windows); - options_init(&s->options, &global_s_options); environ_init(&s->environ); if (env != NULL) environ_copy(env, &s->environ); + s->options = options_create(global_s_options); s->tio = NULL; if (tio != NULL) { @@ -189,6 +189,9 @@ session_free(unused int fd, unused short events, void *arg) log_debug("session %s freed (%d references)", s->name, s->references); if (s->references == 0) { + environ_free(&s->environ); + options_free(s->options); + free(s->name); free(s); } @@ -211,8 +214,6 @@ session_destroy(struct session *s) event_del(&s->lock_timer); session_group_remove(s); - environ_free(&s->environ); - options_free(&s->options); while (!TAILQ_EMPTY(&s->lastw)) winlink_stack_remove(&s->lastw, TAILQ_FIRST(&s->lastw)); @@ -270,7 +271,7 @@ session_update_activity(struct session *s, struct timeval *from) if (~s->flags & SESSION_UNATTACHED) { timerclear(&tv); - tv.tv_sec = options_get_number(&s->options, "lock-after-time"); + tv.tv_sec = options_get_number(s->options, "lock-after-time"); if (tv.tv_sec != 0) evtimer_add(&s->lock_timer, &tv); } @@ -331,11 +332,11 @@ session_new(struct session *s, const char *name, int argc, char **argv, environ_copy(&s->environ, &env); server_fill_environ(s, &env); - shell = options_get_string(&s->options, "default-shell"); + shell = options_get_string(s->options, "default-shell"); if (*shell == '\0' || areshell(shell)) shell = _PATH_BSHELL; - hlimit = options_get_number(&s->options, "history-limit"); + hlimit = options_get_number(s->options, "history-limit"); w = window_create(name, argc, argv, path, shell, cwd, &env, s->tio, s->sx, s->sy, hlimit, cause); if (w == NULL) { @@ -347,8 +348,8 @@ session_new(struct session *s, const char *name, int argc, char **argv, notify_window_linked(s, w); environ_free(&env); - if (options_get_number(&s->options, "set-remain-on-exit")) - options_set_number(&w->options, "remain-on-exit", 1); + if (options_get_number(s->options, "set-remain-on-exit")) + options_set_number(w->options, "remain-on-exit", 1); session_group_synchronize_from(s); return (wl); @@ -711,7 +712,7 @@ session_renumber_windows(struct session *s) RB_INIT(&s->windows); /* Start renumbering from the base-index if it's set. */ - new_idx = options_get_number(&s->options, "base-index"); + new_idx = options_get_number(s->options, "base-index"); new_curw_idx = 0; /* Go through the winlinks and assign new indexes. */ |