Fix bugs with empty panes and load-buffer -w, GitHub issue 5701 from

Alexandre Fiori.
This commit is contained in:
nicm
2026-10-08 07:06:26 +00:00
committed by tmux update bot
parent 9a92292029
commit cb44afd415
3 changed files with 10 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: cmd-load-buffer.c,v 1.66 2025/10/28 07:32:26 nicm Exp $ */ /* $OpenBSD: cmd-load-buffer.c,v 1.67 2026/10/08 07:06:26 nicm Exp $ */
/* /*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -78,9 +78,9 @@ cmd_load_buffer_done(__unused struct client *c, const char *path, int error,
tc->session != NULL && tc->session != NULL &&
(~tc->flags & CLIENT_DEAD)) (~tc->flags & CLIENT_DEAD))
tty_set_selection(&tc->tty, "", copy, bsize); tty_set_selection(&tc->tty, "", copy, bsize);
if (tc != NULL)
server_client_unref(tc);
} }
if (tc != NULL)
server_client_unref(tc);
cmdq_continue(item); cmdq_continue(item);
free(cdata->name); free(cdata->name);

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: spawn.c,v 1.55 2026/10/07 12:55:41 nicm Exp $ */ /* $OpenBSD: spawn.c,v 1.56 2026/10/08 07:06:26 nicm Exp $ */
/* /*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -462,6 +462,8 @@ spawn_pane(struct spawn_context *sc, char **cause)
/* If the command is empty, don't fork a child process. */ /* If the command is empty, don't fork a child process. */
if (sc->flags & SPAWN_EMPTY) { if (sc->flags & SPAWN_EMPTY) {
new_wp->flags |= PANE_EMPTY; new_wp->flags |= PANE_EMPTY;
new_wp->pid = 0;
*new_wp->tty = '\0';
new_wp->base.mode &= ~MODE_CURSOR; new_wp->base.mode &= ~MODE_CURSOR;
new_wp->base.mode |= MODE_CRLF; new_wp->base.mode |= MODE_CRLF;
goto complete; goto complete;

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: window.c,v 1.384 2026/10/02 12:48:52 nicm Exp $ */ /* $OpenBSD: window.c,v 1.385 2026/10/08 07:06:26 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1585,9 +1585,11 @@ window_pane_destroy(struct window_pane *wp)
window_pane_free_modes(wp); window_pane_free_modes(wp);
screen_write_sync_clear_dirty(wp); screen_write_sync_clear_dirty(wp);
if (wp->fd != -1) { if (wp->event != NULL) {
bufferevent_free(wp->event); bufferevent_free(wp->event);
wp->event = NULL; wp->event = NULL;
}
if (wp->fd != -1) {
close(wp->fd); close(wp->fd);
wp->fd = -1; wp->fd = -1;
} }