=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.384 retrieving revision 1.385 diff -c -r1.384 -r1.385 *** src/usr.bin/tmux/server-client.c 2021/08/22 13:48:29 1.384 --- src/usr.bin/tmux/server-client.c 2021/08/27 17:15:57 1.385 *************** *** 1,4 **** ! /* $OpenBSD: server-client.c,v 1.384 2021/08/22 13:48:29 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server-client.c,v 1.385 2021/08/27 17:15:57 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 2443,2449 **** } /* Get client window. */ ! static struct client_window * server_client_get_client_window(struct client *c, u_int id) { struct client_window cw = { .window = id }; --- 2443,2449 ---- } /* Get client window. */ ! struct client_window * server_client_get_client_window(struct client *c, u_int id) { struct client_window cw = { .window = id }; *************** *** 2451,2456 **** --- 2451,2471 ---- return (RB_FIND(client_windows, &c->windows, &cw)); } + /* Add client window. */ + struct client_window * + server_client_add_client_window(struct client *c, u_int id) + { + struct client_window *cw; + + cw = server_client_get_client_window(c, id); + if (cw == NULL) { + cw = xcalloc(1, sizeof *cw); + cw->window = id; + RB_INSERT(client_windows, &c->windows, cw); + } + return cw; + } + /* Get client active pane. */ struct window_pane * server_client_get_pane(struct client *c) *************** *** 2479,2490 **** if (s == NULL) return; ! cw = server_client_get_client_window(c, s->curw->window->id); ! if (cw == NULL) { ! cw = xcalloc(1, sizeof *cw); ! cw->window = s->curw->window->id; ! RB_INSERT(client_windows, &c->windows, cw); ! } cw->pane = wp; log_debug("%s pane now %%%u", c->name, wp->id); } --- 2494,2500 ---- if (s == NULL) return; ! cw = server_client_add_client_window(c, s->curw->window->id); cw->pane = wp; log_debug("%s pane now %%%u", c->name, wp->id); }