Problem: Using freed memory when using synstack() and synID() in WinEnter.
Solution: Check using the syntax window. (closes #10204)
int keep_state) // keep state of char at "col"
{
// When the position is not after the current position and in the same
- // line of the same buffer, need to restart parsing.
- if (wp->w_buffer != syn_buf
+ // line of the same window with the same buffer, need to restart parsing.
+ if (wp != syn_win
+ || wp->w_buffer != syn_buf
|| lnum != current_lnum
|| col < current_col)
syntax_start(wp, lnum);
bw!
endfunc
+" This was using freed memory
+func Test_WinEnter_synstack_synID()
+ autocmd WinEnter * call synstack(line("."), col("."))
+ autocmd WinEnter * call synID(line('.'), col('.') - 1, 1)
+ call setline(1, 'aaaaa')
+ normal! $
+ new
+ close
+
+ au! WinEnter
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4762,
/**/
4761,
/**/