diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-12-20 00:03:55 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-12-20 00:03:55 +0000 |
commit | a51dcdc430150b688d56ec35e8c96ce6f978f68b (patch) | |
tree | f006980fa330e0dd844d56d142a80993ef60ac3e /cmd-choose-window.c | |
parent | c65d4220f019b8022ae0192d4a9014be5cc08f40 (diff) |
Unify the way sessions are used by callbacks - store the address and use
the reference count, then check it is still on the global sessions list
in the callback.
Diffstat (limited to 'cmd-choose-window.c')
-rw-r--r-- | cmd-choose-window.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd-choose-window.c b/cmd-choose-window.c index b3e4b2b3..3f4c956b 100644 --- a/cmd-choose-window.c +++ b/cmd-choose-window.c @@ -129,20 +129,19 @@ void cmd_choose_window_callback(void *data, int idx) { struct cmd_choose_window_data *cdata = data; + struct session *s = cdata->session; struct cmd_list *cmdlist; struct cmd_ctx ctx; char *target, *template, *cause; if (idx == -1) return; - if (cdata->client->flags & CLIENT_DEAD) - return; - if (cdata->session->flags & SESSION_DEAD) + if (!session_alive(s)) return; - if (cdata->client->session != cdata->session) + if (cdata->client->flags & CLIENT_DEAD) return; - xasprintf(&target, "%s:%d", cdata->session->name, idx); + xasprintf(&target, "%s:%d", s->name, idx); template = cmd_template_replace(cdata->template, target, 1); xfree(target); |