# HG changeset patch # User Christian Brabandt # Date 1479044703 -3600 # Node ID dd397210a2d36e23b0c218b8dbb4aae40506ab00 # Parent ba844c78f2af9882152e68c21b891fb66cc97c8a commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3 Author: Bram Moolenaar 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. diff --git a/src/testdir/test_window_id.vim b/src/testdir/test_window_id.vim --- 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 diff --git a/src/version.c b/src/version.c --- 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, diff --git a/src/window.c b/src/window.c --- 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)