mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:17:31 +00:00 
			
		
		
		
	If a pane is killed, cancel reading from the file. GitHub issue 3422.
This commit is contained in:
		
							
								
								
									
										16
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								window.c
									
									
									
									
									
								
							@@ -66,6 +66,7 @@ static u_int	next_active_point;
 | 
			
		||||
struct window_pane_input_data {
 | 
			
		||||
	struct cmdq_item	*item;
 | 
			
		||||
	u_int			 wp;
 | 
			
		||||
	struct client_file	*file;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static struct window_pane *window_pane_create(struct window *, u_int, u_int,
 | 
			
		||||
@@ -1533,18 +1534,16 @@ window_pane_input_callback(struct client *c, __unused const char *path,
 | 
			
		||||
	size_t				 len = EVBUFFER_LENGTH(buffer);
 | 
			
		||||
 | 
			
		||||
	wp = window_pane_find_by_id(cdata->wp);
 | 
			
		||||
	if (wp == NULL || closed || error != 0 || (c->flags & CLIENT_DEAD)) {
 | 
			
		||||
	if (cdata->file != NULL && (wp == NULL || c->flags & CLIENT_DEAD)) {
 | 
			
		||||
		if (wp == NULL)
 | 
			
		||||
			c->flags |= CLIENT_EXIT;
 | 
			
		||||
 | 
			
		||||
		evbuffer_drain(buffer, len);
 | 
			
		||||
		file_cancel(cdata->file);
 | 
			
		||||
	} else if (cdata->file == NULL || closed || error != 0) {
 | 
			
		||||
		cmdq_continue(cdata->item);
 | 
			
		||||
 | 
			
		||||
		server_client_unref(c);
 | 
			
		||||
		free(cdata);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	input_parse_buffer(wp, buf, len);
 | 
			
		||||
	} else
 | 
			
		||||
		input_parse_buffer(wp, buf, len);
 | 
			
		||||
	evbuffer_drain(buffer, len);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1567,9 +1566,8 @@ window_pane_start_input(struct window_pane *wp, struct cmdq_item *item,
 | 
			
		||||
	cdata = xmalloc(sizeof *cdata);
 | 
			
		||||
	cdata->item = item;
 | 
			
		||||
	cdata->wp = wp->id;
 | 
			
		||||
 | 
			
		||||
	cdata->file = file_read(c, "-", window_pane_input_callback, cdata);
 | 
			
		||||
	c->references++;
 | 
			
		||||
	file_read(c, "-", window_pane_input_callback, cdata);
 | 
			
		||||
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user