mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	If the pane is still on all_window_panes but not actually connected to
window or session (which can happen if it is killed during a command sequence and something else has a reference), fall back to the best effort. Fixes "tmux killw\; detach" for Rudis Muiznieks.
This commit is contained in:
		
							
								
								
									
										33
									
								
								cmd-find.c
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								cmd-find.c
									
									
									
									
									
								
							@@ -255,7 +255,28 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)
 | 
				
			|||||||
		wp = NULL;
 | 
							wp = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Not running in a pane. We know nothing. Find the best session. */
 | 
						/* Not running in a pane. We know nothing. Find the best session. */
 | 
				
			||||||
	if (wp == NULL) {
 | 
						if (wp == NULL)
 | 
				
			||||||
 | 
							goto unknown_pane;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* We now know the window and pane. */
 | 
				
			||||||
 | 
						fs->w = wp->window;
 | 
				
			||||||
 | 
						fs->wp = wp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Find the best session and winlink. */
 | 
				
			||||||
 | 
						if (cmd_find_best_session_with_window(fs) != 0) {
 | 
				
			||||||
 | 
							if (wp != NULL) {
 | 
				
			||||||
 | 
								/*
 | 
				
			||||||
 | 
								 * The window may have been destroyed but the pane
 | 
				
			||||||
 | 
								 * still on all_window_panes due to something else
 | 
				
			||||||
 | 
								 * holding a reference.
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								goto unknown_pane;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return (-1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return (0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					unknown_pane:
 | 
				
			||||||
	fs->s = cmd_find_best_session(NULL, 0, fs->flags);
 | 
						fs->s = cmd_find_best_session(NULL, 0, fs->flags);
 | 
				
			||||||
	if (fs->s == NULL)
 | 
						if (fs->s == NULL)
 | 
				
			||||||
		return (-1);
 | 
							return (-1);
 | 
				
			||||||
@@ -266,16 +287,6 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)
 | 
				
			|||||||
	return (0);
 | 
						return (0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* We now know the window and pane. */
 | 
					 | 
				
			||||||
	fs->w = wp->window;
 | 
					 | 
				
			||||||
	fs->wp = wp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Find the best session and winlink. */
 | 
					 | 
				
			||||||
	if (cmd_find_best_session_with_window(fs) != 0)
 | 
					 | 
				
			||||||
		return (-1);
 | 
					 | 
				
			||||||
	return (0);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Work out the best current state. If this function succeeds, the state is
 | 
					 * Work out the best current state. If this function succeeds, the state is
 | 
				
			||||||
 * guaranteed to be completely filled in.
 | 
					 * guaranteed to be completely filled in.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user