mirror of
https://github.com/tmux/tmux.git
synced 2026-10-10 04:04:27 +00:00
Merge branch 'obsd-master'
This commit is contained in:
4
tmux.h
4
tmux.h
@@ -1265,6 +1265,7 @@ struct visible_ranges {
|
|||||||
/* Child window structure. */
|
/* Child window structure. */
|
||||||
struct window_pane {
|
struct window_pane {
|
||||||
u_int id;
|
u_int id;
|
||||||
|
int references;
|
||||||
u_int active_point;
|
u_int active_point;
|
||||||
|
|
||||||
struct window *window;
|
struct window *window;
|
||||||
@@ -1296,6 +1297,7 @@ struct window_pane {
|
|||||||
#define PANE_THEMECHANGED 0x2000
|
#define PANE_THEMECHANGED 0x2000
|
||||||
#define PANE_UNSEENCHANGES 0x4000
|
#define PANE_UNSEENCHANGES 0x4000
|
||||||
#define PANE_REDRAWSCROLLBAR 0x8000
|
#define PANE_REDRAWSCROLLBAR 0x8000
|
||||||
|
#define PANE_DESTROYED 0x10000
|
||||||
|
|
||||||
bitstr_t *sync_dirty;
|
bitstr_t *sync_dirty;
|
||||||
u_int sync_dirty_size;
|
u_int sync_dirty_size;
|
||||||
@@ -3653,6 +3655,8 @@ void window_pane_stack_remove(struct window_panes *,
|
|||||||
void window_set_name(struct window *, const char *, int);
|
void window_set_name(struct window *, const char *, int);
|
||||||
void window_add_ref(struct window *, const char *);
|
void window_add_ref(struct window *, const char *);
|
||||||
void window_remove_ref(struct window *, const char *);
|
void window_remove_ref(struct window *, const char *);
|
||||||
|
void window_pane_add_ref(struct window_pane *, const char *);
|
||||||
|
void window_pane_remove_ref(struct window_pane *, const char *);
|
||||||
void winlink_clear_flags(struct winlink *);
|
void winlink_clear_flags(struct winlink *);
|
||||||
int winlink_shuffle_up(struct session *, struct winlink *, int);
|
int winlink_shuffle_up(struct session *, struct winlink *, int);
|
||||||
int window_pane_start_input(struct window_pane *,
|
int window_pane_start_input(struct window_pane *,
|
||||||
|
|||||||
49
window.c
49
window.c
@@ -71,6 +71,7 @@ struct window_pane_input_data {
|
|||||||
static struct window_pane *window_pane_create(struct window *, u_int, u_int,
|
static struct window_pane *window_pane_create(struct window *, u_int, u_int,
|
||||||
u_int);
|
u_int);
|
||||||
static void window_pane_destroy(struct window_pane *);
|
static void window_pane_destroy(struct window_pane *);
|
||||||
|
static void window_pane_free(struct window_pane *);
|
||||||
static void window_pane_scrollbar_timer(int, short, void *);
|
static void window_pane_scrollbar_timer(int, short, void *);
|
||||||
static void window_pane_full_size_offset(struct window_pane *wp,
|
static void window_pane_full_size_offset(struct window_pane *wp,
|
||||||
int *xoff, int *yoff, u_int *sx, u_int *sy);
|
int *xoff, int *yoff, u_int *sx, u_int *sy);
|
||||||
@@ -419,6 +420,25 @@ window_remove_ref(struct window *w, const char *from)
|
|||||||
window_destroy(w);
|
window_destroy(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
window_pane_add_ref(struct window_pane *wp, const char *from)
|
||||||
|
{
|
||||||
|
wp->references++;
|
||||||
|
log_debug("%s: %%%u %s, now %d", __func__, wp->id, from,
|
||||||
|
wp->references);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
window_pane_remove_ref(struct window_pane *wp, const char *from)
|
||||||
|
{
|
||||||
|
wp->references--;
|
||||||
|
log_debug("%s: %%%u %s, now %d", __func__, wp->id, from,
|
||||||
|
wp->references);
|
||||||
|
|
||||||
|
if (wp->references == 0)
|
||||||
|
window_pane_free(wp);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
window_set_name(struct window *w, const char *new_name, int untrusted)
|
window_set_name(struct window *w, const char *new_name, int untrusted)
|
||||||
{
|
{
|
||||||
@@ -1080,6 +1100,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
|||||||
char host[HOST_NAME_MAX + 1];
|
char host[HOST_NAME_MAX + 1];
|
||||||
|
|
||||||
wp = xcalloc(1, sizeof *wp);
|
wp = xcalloc(1, sizeof *wp);
|
||||||
|
wp->references = 1;
|
||||||
wp->window = w;
|
wp->window = w;
|
||||||
wp->options = options_create(w->options);
|
wp->options = options_create(w->options);
|
||||||
wp->flags = PANE_STYLECHANGED;
|
wp->flags = PANE_STYLECHANGED;
|
||||||
@@ -1208,10 +1229,11 @@ window_pane_destroy(struct window_pane *wp)
|
|||||||
spawn_editor_finish(wp);
|
spawn_editor_finish(wp);
|
||||||
|
|
||||||
window_pane_clear_prompt(wp);
|
window_pane_clear_prompt(wp);
|
||||||
|
RB_REMOVE(window_pane_tree, &all_window_panes, wp);
|
||||||
|
wp->flags |= PANE_DESTROYED;
|
||||||
|
|
||||||
window_pane_free_modes(wp);
|
window_pane_free_modes(wp);
|
||||||
screen_write_clear_dirty(wp);
|
screen_write_clear_dirty(wp);
|
||||||
free(wp->searchstr);
|
|
||||||
|
|
||||||
if (wp->fd != -1) {
|
if (wp->fd != -1) {
|
||||||
#ifdef HAVE_UTEMPTER
|
#ifdef HAVE_UTEMPTER
|
||||||
@@ -1219,18 +1241,20 @@ window_pane_destroy(struct window_pane *wp)
|
|||||||
kill(getpid(), SIGCHLD);
|
kill(getpid(), SIGCHLD);
|
||||||
#endif
|
#endif
|
||||||
bufferevent_free(wp->event);
|
bufferevent_free(wp->event);
|
||||||
|
wp->event = NULL;
|
||||||
close(wp->fd);
|
close(wp->fd);
|
||||||
|
wp->fd = -1;
|
||||||
}
|
}
|
||||||
if (wp->ictx != NULL)
|
if (wp->ictx != NULL) {
|
||||||
input_free(wp->ictx);
|
input_free(wp->ictx);
|
||||||
|
wp->ictx = NULL;
|
||||||
screen_free(&wp->status_screen);
|
}
|
||||||
|
|
||||||
screen_free(&wp->base);
|
|
||||||
|
|
||||||
if (wp->pipe_fd != -1) {
|
if (wp->pipe_fd != -1) {
|
||||||
bufferevent_free(wp->pipe_event);
|
bufferevent_free(wp->pipe_event);
|
||||||
|
wp->pipe_event = NULL;
|
||||||
close(wp->pipe_fd);
|
close(wp->pipe_fd);
|
||||||
|
wp->pipe_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event_initialized(&wp->resize_timer))
|
if (event_initialized(&wp->resize_timer))
|
||||||
@@ -1241,7 +1265,18 @@ window_pane_destroy(struct window_pane *wp)
|
|||||||
event_del(&wp->sb_auto_timer);
|
event_del(&wp->sb_auto_timer);
|
||||||
window_pane_clear_resizes(wp, NULL);
|
window_pane_clear_resizes(wp, NULL);
|
||||||
|
|
||||||
RB_REMOVE(window_pane_tree, &all_window_panes, wp);
|
window_pane_remove_ref(wp, __func__);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
window_pane_free(struct window_pane *wp)
|
||||||
|
{
|
||||||
|
log_debug("pane %%%u freed (%d references)", wp->id, wp->references);
|
||||||
|
|
||||||
|
free(wp->searchstr);
|
||||||
|
|
||||||
|
screen_free(&wp->status_screen);
|
||||||
|
screen_free(&wp->base);
|
||||||
|
|
||||||
options_free(wp->options);
|
options_free(wp->options);
|
||||||
free((void *)wp->cwd);
|
free((void *)wp->cwd);
|
||||||
|
|||||||
Reference in New Issue
Block a user