summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-07-24 17:51:57 +0200
committerBram Moolenaar <Bram@vim.org>2013-07-24 17:51:57 +0200
commitff18df03c3b714caca4f76e50defcb29eb523e15 (patch)
tree4039c827e9973117ea6f8c9c4a5007ae28f2a21f /src/window.c
parentaf003f638415d20ee72cf137e47da38029c627db (diff)
downloadvim-git-ff18df03c3b714caca4f76e50defcb29eb523e15.tar.gz
updated for version 7.4a.044v7.4a.044
Problem: Test 96 sometimes fails. Solution: Clear window from b_wininfo in win_free(). (Suggestion by Yukihiro Nakadaira)
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c
index d1c1e93d9..16e0ee78b 100644
--- 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