Free modes rather than going through reset when pane is destroyed as the

reset path may try to destroy the pane again.
This commit is contained in:
nicm
2026-06-24 21:10:05 +00:00
parent 280a962328
commit ba9faae8b6

View File

@@ -1127,13 +1127,28 @@ window_pane_wait_finish(struct window_pane *wp)
cmdq_continue(item);
}
static void
window_pane_free_modes(struct window_pane *wp)
{
struct window_mode_entry *wme;
while (!TAILQ_EMPTY(&wp->modes)) {
wme = TAILQ_FIRST(&wp->modes);
TAILQ_REMOVE(&wp->modes, wme, entry);
wme->mode->free(wme);
free(wme);
}
wp->screen = &wp->base;
}
static void
window_pane_destroy(struct window_pane *wp)
{
window_pane_wait_finish(wp);
spawn_editor_finish(wp);
window_pane_reset_mode_all(wp);
window_pane_free_modes(wp);
free(wp->searchstr);
if (wp->fd != -1) {