For tree mode, hold a reference to prompt and other bits across command

to avoid crashing when killing the session with the mode's pane. GitHub
issue 5728.
This commit is contained in:
nicm
2026-10-12 18:23:25 +00:00
committed by tmux update bot
parent 7d01314422
commit 0985de0bc6
2 changed files with 25 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: window-tree.c,v 1.96 2026/08/25 07:23:30 nicm Exp $ */
/* $OpenBSD: window-tree.c,v 1.97 2026/10/12 18:23:25 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1344,12 +1344,10 @@ window_tree_kill_current_callback(struct client *c, void *modedata,
if (tolower((u_char) s[0]) != 'y' || s[1] != '\0')
return (PROMPT_CLOSE);
data->references++;
window_tree_kill_each(data, mode_tree_get_current(mtd), c, KEYC_NONE);
server_renumber_all();
data->references++;
cmdq_append(c, cmdq_get_callback(window_tree_command_done, data));
return (PROMPT_CLOSE);
}
@@ -1365,12 +1363,10 @@ window_tree_kill_tagged_callback(struct client *c, void *modedata,
if (tolower((u_char) s[0]) != 'y' || s[1] != '\0')
return (PROMPT_CLOSE);
data->references++;
mode_tree_each_tagged(mtd, window_tree_kill_each, c, KEYC_NONE, 1);
server_renumber_all();
data->references++;
cmdq_append(c, cmdq_get_callback(window_tree_command_done, data));
return (PROMPT_CLOSE);
}
@@ -1453,6 +1449,8 @@ window_tree_key(struct window_mode_entry *wme, struct client *c,
item = mode_tree_get_current(data->data);
finished = mode_tree_key(data->data, c, &key, m, &x, &y);
if (data->dead)
return;
again:
if (item != (new_item = mode_tree_get_current(data->data))) {