mirror of
https://github.com/neovim/neovim.git
synced 2026-03-29 11:52:04 +00:00
fix(window): don't leak fold memory with style=minimal #38287
Problem: discarding saved option values in the WinInfo of closed style=minimal windows leaks memory. Solution: also free the nested folds.
This commit is contained in:
@@ -5565,6 +5565,7 @@ void win_free(win_T *wp, tabpage_T *tp)
|
||||
// Discard saved options if the style is minimal.
|
||||
if (wp->w_config.style == kWinStyleMinimal && wip_wp->wi_optset) {
|
||||
clear_winopt(&wip_wp->wi_opt);
|
||||
deleteFoldRecurse(buf, &wip_wp->wi_folds);
|
||||
wip_wp->wi_optset = false;
|
||||
}
|
||||
// If there already is an entry with "wi_win" set to NULL, only
|
||||
|
||||
@@ -3650,5 +3650,11 @@ describe('API/win', function()
|
||||
eq(1, eval('&number'))
|
||||
eq(1, eval('&rightleft')) -- unrelated option unaffected
|
||||
end)
|
||||
|
||||
it('minimal style does not leak WinInfo fold memory', function()
|
||||
feed('zfG')
|
||||
api.nvim_open_win(0, true, { split = 'below', style = 'minimal' })
|
||||
command('quit')
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user