mirror of
https://github.com/neovim/neovim.git
synced 2026-07-21 00:21:38 +00:00
fix: :ball w_locked check, reset b_nwindows in free_all_mem() #38484
Problem: - Small error in port of v9.1.0678, causing :ball to check w_locked for the wrong window. - After #27439, free_all_mem() may not wipe out buffers that were open in more than one window before windows were freed. Solution: - Check win_locked() for wp in ex_buffer_all(), not curwin. - Set b_nwindows to 0 in free_all_mem() before calling close_buffer(). Ref: https://github.com/neovim/neovim/pull/38473#issuecomment-4125117681 No need to block these fixes on that. free_all_mem() change also looks like it fixed the existing "N lua references were leaked!" warnings on the CI.
This commit is contained in:
@@ -3663,7 +3663,7 @@ void ex_buffer_all(exarg_T *eap)
|
|||||||
: wp->w_width != Columns)
|
: wp->w_width != Columns)
|
||||||
|| (had_tab > 0 && wp != firstwin))
|
|| (had_tab > 0 && wp != firstwin))
|
||||||
&& !ONE_WINDOW
|
&& !ONE_WINDOW
|
||||||
&& !(win_locked(curwin) || wp->w_buffer->b_locked > 0)
|
&& !(win_locked(wp) || wp->w_buffer->b_locked > 0)
|
||||||
&& !is_aucmd_win(wp)) {
|
&& !is_aucmd_win(wp)) {
|
||||||
if (win_close(wp, false, false) == FAIL) {
|
if (win_close(wp, false, false) == FAIL) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -950,6 +950,8 @@ void free_all_mem(void)
|
|||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
nextbuf = buf->b_next;
|
nextbuf = buf->b_next;
|
||||||
|
// All windows were freed. Reset b_nwindows so buffers can be wiped.
|
||||||
|
buf->b_nwindows = 0;
|
||||||
|
|
||||||
// Since options (in addition to other stuff) have been freed above we need to ensure no
|
// Since options (in addition to other stuff) have been freed above we need to ensure no
|
||||||
// callbacks are called, so free them before closing the buffer.
|
// callbacks are called, so free them before closing the buffer.
|
||||||
|
|||||||
Reference in New Issue
Block a user