]> granicus.if.org Git - vim/commitdiff
patch 8.0.0083 v8.0.0083
authorBram Moolenaar <Bram@vim.org>
Sun, 13 Nov 2016 13:31:40 +0000 (14:31 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 13 Nov 2016 13:31:40 +0000 (14:31 +0100)
Problem:    Using freed memory with win_getid(). (Domenique Pelle)
Solution:   For the current tab use curwin.

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

index 66656e1d0a9c943c6e9453aab69fa48c72563a2a..b3b506d04d8c7141ced16ecd2ac6d886594bb3ad 100644 (file)
@@ -92,3 +92,12 @@ func Test_win_getid()
 
   only!
 endfunc
+
+func Test_win_getid_curtab()
+  tabedit X
+  tabfirst
+  copen
+  only
+  call assert_equal(win_getid(1), win_getid(1, 1))
+  tabclose!
+endfunc
index e85192247e2c5274c114b7a54174fb2dc5092621..c7f00a8764065dc4d4c3931efd6737b51f64c91b 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    83,
 /**/
     82,
 /**/
index 8e5336883fd0599f2626420339b104077213e7e4..ee5f7aa8aa6ec14f8bfa609a8d03783877da19ef 100644 (file)
@@ -7133,7 +7133,10 @@ win_getid(typval_T *argvars)
                    break;
            if (tp == NULL)
                return -1;
-           wp = tp->tp_firstwin;
+           if (tp == curtab)
+               wp = firstwin;
+           else
+               wp = tp->tp_firstwin;
        }
        for ( ; wp != NULL; wp = wp->w_next)
            if (--winnr == 0)