summaryrefslogtreecommitdiffstats
path: root/cmd-choose-window.c
authortcunha <tcunha>2010-12-22 15:28:50 (GMT)
committer tcunha <tcunha>2010-12-22 15:28:50 (GMT)
commitc8befcf75e1c1760b18ab79af0467df1b6b2b270 (patch) (side-by-side diff)
treeba3a25b93d9cce310cfe39b72d55ec5f8bc1d2c8 /cmd-choose-window.c
parentd5f4ad9ee95ebfe2802bc766fbce5e0cdf6a8c62 (diff)
downloadtmux-old-c8befcf75e1c1760b18ab79af0467df1b6b2b270.zip
tmux-old-c8befcf75e1c1760b18ab79af0467df1b6b2b270.tar.gz
tmux-old-c8befcf75e1c1760b18ab79af0467df1b6b2b270.tar.bz2
Sync OpenBSD patchset 801:
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') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-choose-window.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/cmd-choose-window.c b/cmd-choose-window.c
index ecdb959..8594036 100644
--- a/cmd-choose-window.c
+++ b/cmd-choose-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-choose-window.c,v 1.23 2010/12/06 22:52:20 nicm Exp $ */
+/* $Id: cmd-choose-window.c,v 1.24 2010/12/22 15:28:50 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <[email protected]>
@@ -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);