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/buffer.c | |
parent | 89b693e5627715cde080c3580c7b641c9bf0c06a (diff) |
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/buffer.c')
-rw-r--r-- | src/buffer.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/buffer.c b/src/buffer.c index 318ce7f988..5a5eb9f416 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1006,6 +1006,22 @@ free_buffer_stuff( } /* + * 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". */ static void @@ -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); } } |