Mercurial > vim
comparison src/window.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 | e82579016863 |
children | 8e7cbf73c3a0 |
comparison
equal
deleted
inserted
replaced
22712:82bfe1464940 | 22713:e871a824efc9 |
---|---|
5013 // Remove the window from the b_wininfo lists, it may happen that the | 5013 // Remove the window from the b_wininfo lists, it may happen that the |
5014 // freed memory is re-used for another window. | 5014 // freed memory is re-used for another window. |
5015 FOR_ALL_BUFFERS(buf) | 5015 FOR_ALL_BUFFERS(buf) |
5016 FOR_ALL_BUF_WININFO(buf, wip) | 5016 FOR_ALL_BUF_WININFO(buf, wip) |
5017 if (wip->wi_win == wp) | 5017 if (wip->wi_win == wp) |
5018 { | |
5019 wininfo_T *wip2; | |
5020 | |
5021 // If there already is an entry with "wi_win" set to NULL it | |
5022 // must be removed, it would never be used. | |
5023 for (wip2 = buf->b_wininfo; wip2 != NULL; wip2 = wip2->wi_next) | |
5024 if (wip2->wi_win == NULL) | |
5025 { | |
5026 if (wip2->wi_next != NULL) | |
5027 wip2->wi_next->wi_prev = wip2->wi_prev; | |
5028 if (wip2->wi_prev == NULL) | |
5029 buf->b_wininfo = wip2->wi_next; | |
5030 else | |
5031 wip2->wi_prev->wi_next = wip2->wi_next; | |
5032 free_wininfo(wip2); | |
5033 break; | |
5034 } | |
5035 | |
5018 wip->wi_win = NULL; | 5036 wip->wi_win = NULL; |
5037 } | |
5019 | 5038 |
5020 #ifdef FEAT_SEARCH_EXTRA | 5039 #ifdef FEAT_SEARCH_EXTRA |
5021 clear_matches(wp); | 5040 clear_matches(wp); |
5022 #endif | 5041 #endif |
5023 | 5042 |