diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2013-03-22 15:54:29 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2013-03-22 15:54:29 +0000 |
commit | 2243cfbe7559e6cf48194ff95dcd7eb6df5fe41d (patch) | |
tree | d1cf60483d7b08f01f00610c5e341d26520557c9 | |
parent | d644e5143fbce243ddcca468a1b8a1d5bfd21b34 (diff) | |
download | rtmux-2243cfbe7559e6cf48194ff95dcd7eb6df5fe41d.tar.gz rtmux-2243cfbe7559e6cf48194ff95dcd7eb6df5fe41d.tar.bz2 rtmux-2243cfbe7559e6cf48194ff95dcd7eb6df5fe41d.zip |
Need to set clients in context before changing their reference count.
-rw-r--r-- | cfg.c | 2 | ||||
-rw-r--r-- | cmd-command-prompt.c | 3 | ||||
-rw-r--r-- | cmd-confirm-before.c | 3 | ||||
-rw-r--r-- | cmd.c | 5 | ||||
-rw-r--r-- | control.c | 3 | ||||
-rw-r--r-- | key-bindings.c | 3 | ||||
-rw-r--r-- | server-client.c | 3 | ||||
-rw-r--r-- | window-choose.c | 11 |
8 files changed, 15 insertions, 18 deletions
@@ -92,7 +92,7 @@ load_cfg(const char *path, struct cmd_ctx *ctx, struct causelist *causes) if (ctx != NULL) cmd_ref_ctx(ctx); else { - ctx = cmd_get_ctx(); + ctx = cmd_get_ctx(NULL, NULL); ctx->error = cfg_error; ctx->print = cfg_print; ctx->info = cfg_print; diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index 68573195..80407b7d 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -184,8 +184,7 @@ cmd_command_prompt_callback(void *data, const char *s) return (0); } - ctx = cmd_get_ctx(); - ctx->curclient = c; + ctx = cmd_get_ctx(NULL, c); ctx->error = key_bindings_error; ctx->print = key_bindings_print; ctx->info = key_bindings_info; diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index 5e3e4e12..f9491095 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -125,8 +125,7 @@ cmd_confirm_before_callback(void *data, const char *s) return (0); } - ctx = cmd_get_ctx(); - ctx->curclient = c; + ctx = cmd_get_ctx(NULL, c); ctx->error = key_bindings_error; ctx->print = key_bindings_print; ctx->info = key_bindings_info; @@ -134,13 +134,16 @@ int cmd_find_index_offset(const char *, struct session *, int *); struct window_pane *cmd_find_pane_offset(const char *, struct winlink *); struct cmd_ctx * -cmd_get_ctx(void) +cmd_get_ctx(struct client *cmdclient, struct client *curclient) { struct cmd_ctx *ctx; ctx = xcalloc(1, sizeof *ctx); ctx->references = 0; + ctx->cmdclient = cmdclient; + ctx->curclient = curclient; + cmd_ref_ctx(ctx); return (ctx); } @@ -108,8 +108,7 @@ control_callback(struct client *c, int closed, unused void *data) break; } - ctx = cmd_get_ctx(); - ctx->curclient = c; + ctx = cmd_get_ctx(NULL, c); ctx->error = control_msg_error; ctx->print = control_msg_print; ctx->info = control_msg_info; diff --git a/key-bindings.c b/key-bindings.c index 6909b4b6..0f944c4c 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -266,8 +266,7 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c) struct cmd *cmd; int readonly; - ctx = cmd_get_ctx(); - ctx->curclient = c; + ctx = cmd_get_ctx(NULL, c); ctx->error = key_bindings_error; ctx->print = key_bindings_print; ctx->info = key_bindings_info; diff --git a/server-client.c b/server-client.c index 0feaa8b2..492d6b22 100644 --- a/server-client.c +++ b/server-client.c @@ -870,9 +870,8 @@ server_client_msg_command(struct client *c, struct msg_command_data *data) int argc; char **argv, *cause; - ctx = cmd_get_ctx(); + ctx = cmd_get_ctx(c, NULL); ctx->msgdata = data; - ctx->cmdclient = c; ctx->error = server_client_msg_error; ctx->print = server_client_msg_print; ctx->info = server_client_msg_info; diff --git a/window-choose.c b/window-choose.c index 14222d65..4443e1a5 100644 --- a/window-choose.c +++ b/window-choose.c @@ -220,8 +220,7 @@ window_choose_data_run(struct window_choose_data *cdata) return; } - ctx = cmd_get_ctx(); - ctx->curclient = cdata->start_client; + ctx = cmd_get_ctx(NULL, cdata->start_client); ctx->error = key_bindings_error; ctx->print = key_bindings_print; ctx->info = key_bindings_info; @@ -492,7 +491,7 @@ window_choose_key(struct window_pane *wp, unused struct session *sess, int key) items = ARRAY_LENGTH(&data->list); if (data->input_type == WINDOW_CHOOSE_GOTO_ITEM) { - switch (mode_key_lookup(&data->mdata, key)) { + switch (mode_key_lookup(&data->mdata, key, NULL)) { case MODEKEYCHOICE_CANCEL: data->input_type = WINDOW_CHOOSE_NORMAL; window_choose_redraw_screen(wp); @@ -523,7 +522,7 @@ window_choose_key(struct window_pane *wp, unused struct session *sess, int key) return; } - switch (mode_key_lookup(&data->mdata, key)) { + switch (mode_key_lookup(&data->mdata, key, NULL)) { case MODEKEYCHOICE_CANCEL: window_choose_fire_callback(wp, NULL); break; @@ -777,7 +776,7 @@ window_choose_key_index(struct window_choose_mode_data *data, u_int idx) int mkey; for (ptr = keys; *ptr != '\0'; ptr++) { - mkey = mode_key_lookup(&data->mdata, *ptr); + mkey = mode_key_lookup(&data->mdata, *ptr, NULL); if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER) continue; if (idx-- == 0) @@ -797,7 +796,7 @@ window_choose_index_key(struct window_choose_mode_data *data, int key) u_int idx = 0; for (ptr = keys; *ptr != '\0'; ptr++) { - mkey = mode_key_lookup(&data->mdata, *ptr); + mkey = mode_key_lookup(&data->mdata, *ptr, NULL); if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER) continue; if (key == *ptr) |