changeset 10377:dd397210a2d3 v8.0.0083

commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 13 14:31:40 2016 +0100 patch 8.0.0083 Problem: Using freed memory with win_getid(). (Domenique Pelle) Solution: For the current tab use curwin.
author Christian Brabandt <cb@256bit.org>
date Sun, 13 Nov 2016 14:45:03 +0100
parents ba844c78f2af
children e0c401329563
files src/testdir/test_window_id.vim src/version.c src/window.c
diffstat 3 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_window_id.vim
+++ b/src/testdir/test_window_id.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    83,
+/**/
     82,
 /**/
     81,
--- a/src/window.c
+++ b/src/window.c
@@ -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)