diff src/buffer.c @ 22713:e871a824efc9 v8.2.1905

patch 8.2.1905: the wininfo list may contain stale entries Commit: https://github.com/vim/vim/commit/4882d983397057ea91c584c5a54aaccf15016d18 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 25 17:55:09 2020 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 25 Oct 2020 18:00:04 +0100
parents 92f221ad267c
children 92a100fc5e17
line wrap: on
line diff
--- 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);
     }
 }