comparison 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
comparison
equal deleted inserted replaced
22712:82bfe1464940 22713:e871a824efc9
1004 map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); // clear local abbrevs 1004 map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); // clear local abbrevs
1005 VIM_CLEAR(buf->b_start_fenc); 1005 VIM_CLEAR(buf->b_start_fenc);
1006 } 1006 }
1007 1007
1008 /* 1008 /*
1009 * Free one wininfo_T.
1010 */
1011 void
1012 free_wininfo(wininfo_T *wip)
1013 {
1014 if (wip->wi_optset)
1015 {
1016 clear_winopt(&wip->wi_opt);
1017 #ifdef FEAT_FOLDING
1018 deleteFoldRecurse(&wip->wi_folds);
1019 #endif
1020 }
1021 vim_free(wip);
1022 }
1023
1024 /*
1009 * Free the b_wininfo list for buffer "buf". 1025 * Free the b_wininfo list for buffer "buf".
1010 */ 1026 */
1011 static void 1027 static void
1012 clear_wininfo(buf_T *buf) 1028 clear_wininfo(buf_T *buf)
1013 { 1029 {
1015 1031
1016 while (buf->b_wininfo != NULL) 1032 while (buf->b_wininfo != NULL)
1017 { 1033 {
1018 wip = buf->b_wininfo; 1034 wip = buf->b_wininfo;
1019 buf->b_wininfo = wip->wi_next; 1035 buf->b_wininfo = wip->wi_next;
1020 if (wip->wi_optset) 1036 free_wininfo(wip);
1021 {
1022 clear_winopt(&wip->wi_opt);
1023 #ifdef FEAT_FOLDING
1024 deleteFoldRecurse(&wip->wi_folds);
1025 #endif
1026 }
1027 vim_free(wip);
1028 } 1037 }
1029 } 1038 }
1030 1039
1031 /* 1040 /*
1032 * Go to another buffer. Handles the result of the ATTENTION dialog. 1041 * Go to another buffer. Handles the result of the ATTENTION dialog.