mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	[RFC] vim-patch:7.4.1704 (#5487)
vim-patch:7.4.1704
Problem:    Using freed memory with "wincmd p". (Dominique Pelle)
Solution:   Also clear "prevwin" in other tab pages.
3dda7db4e1
			
			
This commit is contained in:
		
				
					committed by
					
						
						James McCoy
					
				
			
			
				
	
			
			
			
						parent
						
							6636e2a259
						
					
				
				
					commit
					82f30bfeda
				
			@@ -739,7 +739,7 @@ static int included_patches[] = {
 | 
			
		||||
  // 1707,
 | 
			
		||||
  // 1706 NA
 | 
			
		||||
  // 1705 NA
 | 
			
		||||
  // 1704,
 | 
			
		||||
  1704,
 | 
			
		||||
  1703,
 | 
			
		||||
  // 1702,
 | 
			
		||||
  // 1701,
 | 
			
		||||
 
 | 
			
		||||
@@ -278,10 +278,11 @@ newwindow:
 | 
			
		||||
  /* cursor to last accessed (previous) window */
 | 
			
		||||
  case 'p':
 | 
			
		||||
  case Ctrl_P:
 | 
			
		||||
    if (prevwin == NULL)
 | 
			
		||||
    if (!win_valid(prevwin)) {
 | 
			
		||||
      beep_flush();
 | 
			
		||||
    else
 | 
			
		||||
    } else {
 | 
			
		||||
      win_goto(prevwin);
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
 | 
			
		||||
  /* exchange current and next window */
 | 
			
		||||
@@ -3768,8 +3769,15 @@ win_free (
 | 
			
		||||
  hash_init(&wp->w_vars->dv_hashtab);
 | 
			
		||||
  unref_var_dict(wp->w_vars);
 | 
			
		||||
 | 
			
		||||
  if (prevwin == wp)
 | 
			
		||||
  if (prevwin == wp) {
 | 
			
		||||
    prevwin = NULL;
 | 
			
		||||
  }
 | 
			
		||||
  FOR_ALL_TABS(ttp) {
 | 
			
		||||
    if (ttp->tp_prevwin == wp) {
 | 
			
		||||
      ttp->tp_prevwin = NULL;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  win_free_lsize(wp);
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < wp->w_tagstacklen; ++i)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user