Patch 8.2.1905

5 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 25, 2020, 12:55:58 PM10/25/20
to vim...@googlegroups.com

Patch 8.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.
Files: src/buffer.c, src/proto/buffer.pro, src/window.c


*** ../vim-8.2.1904/src/buffer.c 2020-10-25 17:09:46.217011625 +0100
--- src/buffer.c 2020-10-25 17:11:03.600813096 +0100
***************
*** 1006,1011 ****
--- 1006,1027 ----
}

/*
+ * 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,1030 ****
{
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);
}
}

--- 1033,1039 ----
{
wip = buf->b_wininfo;
buf->b_wininfo = wip->wi_next;
! free_wininfo(wip);
}
}

*** ../vim-8.2.1904/src/proto/buffer.pro 2019-12-14 16:18:11.574458417 +0100
--- src/proto/buffer.pro 2020-10-25 17:11:06.424805838 +0100
***************
*** 8,13 ****
--- 8,14 ----
void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last, int ignore_abort);
void buf_clear_file(buf_T *buf);
void buf_freeall(buf_T *buf, int flags);
+ void free_wininfo(wininfo_T *wip);
void goto_buffer(exarg_T *eap, int start, int dir, int count);
void handle_swap_exists(bufref_T *old_curbuf);
char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit);
*** ../vim-8.2.1904/src/window.c 2020-10-24 20:49:37.502683026 +0200
--- src/window.c 2020-10-25 17:20:04.611412770 +0100
***************
*** 5015,5021 ****
--- 5015,5040 ----
FOR_ALL_BUFFERS(buf)
FOR_ALL_BUF_WININFO(buf, wip)
if (wip->wi_win == wp)
+ {
+ wininfo_T *wip2;
+
+ // If there already is an entry with "wi_win" set to NULL it
+ // must be removed, it would never be used.
+ for (wip2 = buf->b_wininfo; wip2 != NULL; wip2 = wip2->wi_next)
+ if (wip2->wi_win == NULL)
+ {
+ if (wip2->wi_next != NULL)
+ wip2->wi_next->wi_prev = wip2->wi_prev;
+ if (wip2->wi_prev == NULL)
+ buf->b_wininfo = wip2->wi_next;
+ else
+ wip2->wi_prev->wi_next = wip2->wi_next;
+ free_wininfo(wip2);
+ break;
+ }
+
wip->wi_win = NULL;
+ }

#ifdef FEAT_SEARCH_EXTRA
clear_matches(wp);
*** ../vim-8.2.1904/src/version.c 2020-10-25 17:09:46.217011625 +0100
--- src/version.c 2020-10-25 17:54:03.849196391 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1905,
/**/

--
hundred-and-one symptoms of being an internet addict:
129. You cancel your newspaper subscription.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages