# HG changeset patch # User Bram Moolenaar # Date 1374681117 -7200 # Node ID 647596ab1ae2f4b36bfc20293adf4b3a43372818 # Parent 7c3c540f15c3aa7266d99bb242f0a749c89894cd updated for version 7.4a.044 Problem: Test 96 sometimes fails. Solution: Clear window from b_wininfo in win_free(). (Suggestion by Yukihiro Nakadaira) diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 44, +/**/ 43, /**/ 42, diff --git a/src/window.c b/src/window.c --- a/src/window.c +++ b/src/window.c @@ -4518,7 +4518,7 @@ win_alloc(after, hidden) #if defined(FEAT_WINDOWS) || defined(PROTO) /* - * remove window 'wp' from the window list and free the structure + * Remove window 'wp' from the window list and free the structure. */ static void win_free(wp, tp) @@ -4526,6 +4526,8 @@ win_free(wp, tp) tabpage_T *tp; /* tab page "win" is in, NULL for current */ { int i; + buf_T *buf; + wininfo_T *wip; #ifdef FEAT_FOLDING clearFolding(wp); @@ -4586,6 +4588,13 @@ win_free(wp, tp) vim_free(wp->w_localdir); + /* Remove the window from the b_wininfo lists, it may happen that the + * freed memory is re-used for another window. */ + for (buf = firstbuf; buf != NULL; buf = buf->b_next) + for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) + if (wip->wi_win == wp) + wip->wi_win = NULL; + #ifdef FEAT_SEARCH_EXTRA clear_matches(wp); #endif