]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.0137: crash when using win_execute() from a new tab v8.2.0137
authorBram Moolenaar <Bram@vim.org>
Mon, 20 Jan 2020 20:44:31 +0000 (21:44 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 20 Jan 2020 20:44:31 +0000 (21:44 +0100)
Problem:    Crash when using win_execute() from a new tab.
Solution:   Set the tp_*win pointers. (Ozaki Kiichi, closes #5512)

src/testdir/test_winbuf_close.vim
src/version.c
src/window.c

index ee43540fddc6739d66ee0ef79dcda4d57d932050..7f5b80e8d32c8c9b9148c7a656f5faecbfdd7d53 100644 (file)
@@ -160,7 +160,7 @@ func Test_winfixwidth_on_close()
 endfunction
 
 " 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
   botright 11new
   let l:wid = win_getid()
@@ -173,7 +173,7 @@ fun! Test_winfixheight_non_leaf_frame()
 endf
 
 " 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
   topleft 11vnew
   let l:wid = win_getid()
@@ -184,3 +184,13 @@ fun! Test_winfixwidth_non_leaf_frame()
   call assert_equal(11, winwidth(l:wid))
   %bwipe!
 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
index c23426be28ad5a00890f60e0aea6a8a85bd7c0de..6a1702e852a9533a64bb286eef24fa6ee1c5307a 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    137,
 /**/
     136,
 /**/
index 1096b60173b812711f2e481db1c5ce811c807630..0c3c7f690541df557af9e9f758023b41fd31ab60 100644 (file)
@@ -3616,6 +3616,9 @@ win_alloc_first(void)
        return FAIL;
     first_tabpage->tp_topframe = topframe;
     curtab = first_tabpage;
+    curtab->tp_firstwin = firstwin;
+    curtab->tp_lastwin = lastwin;
+    curtab->tp_curwin = curwin;
 
     return OK;
 }
@@ -3854,6 +3857,8 @@ win_new_tabpage(int after)
            newtp->tp_next = tp->tp_next;
            tp->tp_next = newtp;
        }
+       newtp->tp_firstwin = newtp->tp_lastwin = newtp->tp_curwin = curwin;
+
        win_init_size();
        firstwin->w_winrow = tabline_height();
        win_comp_scroll(curwin);