patch 8.0.0083
Problem: Using freed memory with win_getid(). (Domenique Pelle)
Solution: For the current tab use curwin.
diff --git a/src/testdir/test_window_id.vim b/src/testdir/test_window_id.vim
index 66656e1..b3b506d 100644
--- a/src/testdir/test_window_id.vim
+++ b/src/testdir/test_window_id.vim
@@ -92,3 +92,12 @@
only!
endfunc
+
+func Test_win_getid_curtab()
+ tabedit X
+ tabfirst
+ copen
+ only
+ call assert_equal(win_getid(1), win_getid(1, 1))
+ tabclose!
+endfunc
diff --git a/src/version.c b/src/version.c
index e851922..c7f00a8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 83,
+/**/
82,
/**/
81,
diff --git a/src/window.c b/src/window.c
index 8e53368..ee5f7aa 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7133,7 +7133,10 @@
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)