0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.0137: crash when using win_execute() from a new tab

Problem:    Crash when using win_execute() from a new tab.
Solution:   Set the tp_*win pointers. (Ozaki Kiichi, closes #5512)
This commit is contained in:
Bram Moolenaar 2020-01-20 21:44:31 +01:00
parent ed5adff1e6
commit a44b3eeafa
3 changed files with 19 additions and 2 deletions

View File

@ -160,7 +160,7 @@ func Test_winfixwidth_on_close()
endfunction endfunction
" Test that 'winfixheight' will be respected even there is non-leaf frame " Test that 'winfixheight' will be respected even there is non-leaf frame
fun! Test_winfixheight_non_leaf_frame() func Test_winfixheight_non_leaf_frame()
vsplit vsplit
botright 11new botright 11new
let l:wid = win_getid() let l:wid = win_getid()
@ -173,7 +173,7 @@ fun! Test_winfixheight_non_leaf_frame()
endf endf
" Test that 'winfixwidth' will be respected even there is non-leaf frame " Test that 'winfixwidth' will be respected even there is non-leaf frame
fun! Test_winfixwidth_non_leaf_frame() func Test_winfixwidth_non_leaf_frame()
split split
topleft 11vnew topleft 11vnew
let l:wid = win_getid() let l:wid = win_getid()
@ -184,3 +184,13 @@ fun! Test_winfixwidth_non_leaf_frame()
call assert_equal(11, winwidth(l:wid)) call assert_equal(11, winwidth(l:wid))
%bwipe! %bwipe!
endf endf
func Test_tabwin_close()
enew
let l:wid = win_getid()
tabedit
call win_execute(l:wid, 'close')
" Should not crash.
call assert_true(v:true)
%bwipe!
endfunc

View File

@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
137,
/**/ /**/
136, 136,
/**/ /**/

View File

@ -3616,6 +3616,9 @@ win_alloc_first(void)
return FAIL; return FAIL;
first_tabpage->tp_topframe = topframe; first_tabpage->tp_topframe = topframe;
curtab = first_tabpage; curtab = first_tabpage;
curtab->tp_firstwin = firstwin;
curtab->tp_lastwin = lastwin;
curtab->tp_curwin = curwin;
return OK; return OK;
} }
@ -3854,6 +3857,8 @@ win_new_tabpage(int after)
newtp->tp_next = tp->tp_next; newtp->tp_next = tp->tp_next;
tp->tp_next = newtp; tp->tp_next = newtp;
} }
newtp->tp_firstwin = newtp->tp_lastwin = newtp->tp_curwin = curwin;
win_init_size(); win_init_size();
firstwin->w_winrow = tabline_height(); firstwin->w_winrow = tabline_height();
win_comp_scroll(curwin); win_comp_scroll(curwin);