0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.1905: the wininfo list may contain stale entries

Problem:    The wininfo list may contain stale entries.
Solution:   When closing a window remove any other entry where the window
            pointer is NULL.
This commit is contained in:
Bram Moolenaar
2020-10-25 17:55:09 +01:00
parent 89b693e562
commit 4882d98339
4 changed files with 39 additions and 8 deletions

View File

@@ -1005,6 +1005,22 @@ free_buffer_stuff(
VIM_CLEAR(buf->b_start_fenc);
}
/*
* Free one wininfo_T.
*/
void
free_wininfo(wininfo_T *wip)
{
if (wip->wi_optset)
{
clear_winopt(&wip->wi_opt);
#ifdef FEAT_FOLDING
deleteFoldRecurse(&wip->wi_folds);
#endif
}
vim_free(wip);
}
/*
* Free the b_wininfo list for buffer "buf".
*/
@@ -1017,14 +1033,7 @@ clear_wininfo(buf_T *buf)
{
wip = buf->b_wininfo;
buf->b_wininfo = wip->wi_next;
if (wip->wi_optset)
{
clear_winopt(&wip->wi_opt);
#ifdef FEAT_FOLDING
deleteFoldRecurse(&wip->wi_folds);
#endif
}
vim_free(wip);
free_wininfo(wip);
}
}