diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-10-25 17:55:09 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-10-25 17:55:09 +0100 |
commit | 4882d983397057ea91c584c5a54aaccf15016d18 (patch) | |
tree | b793825c5fdfb96bb9ad2a1bae573026e0998e26 /src/window.c | |
parent | 89b693e5627715cde080c3580c7b641c9bf0c06a (diff) | |
download | vim-git-4882d983397057ea91c584c5a54aaccf15016d18.tar.gz |
patch 8.2.1905: the wininfo list may contain stale entriesv8.2.1905
Problem: The wininfo list may contain stale entries.
Solution: When closing a window remove any other entry where the window
pointer is NULL.
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c index 243bd3299..9dbfae210 100644 --- a/src/window.c +++ b/src/window.c @@ -5015,7 +5015,26 @@ win_free( FOR_ALL_BUFFERS(buf) FOR_ALL_BUF_WININFO(buf, wip) if (wip->wi_win == wp) + { + wininfo_T *wip2; + + // If there already is an entry with "wi_win" set to NULL it + // must be removed, it would never be used. + for (wip2 = buf->b_wininfo; wip2 != NULL; wip2 = wip2->wi_next) + if (wip2->wi_win == NULL) + { + if (wip2->wi_next != NULL) + wip2->wi_next->wi_prev = wip2->wi_prev; + if (wip2->wi_prev == NULL) + buf->b_wininfo = wip2->wi_next; + else + wip2->wi_prev->wi_next = wip2->wi_next; + free_wininfo(wip2); + break; + } + wip->wi_win = NULL; + } #ifdef FEAT_SEARCH_EXTRA clear_matches(wp); |