mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.3572: memory leak when closing window and using "multispace"
Problem: Memory leak when closing window and using "multispace" in
'listchars'.
Solution: Free the memory. (closes vim/vim#9071)
7a33ebfc5b
This commit is contained in:
parent
5ed2a5cf9c
commit
8dbe47a4bc
@ -440,7 +440,7 @@ func Test_listchars_window_local()
|
|||||||
call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
|
call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
|
||||||
|
|
||||||
" Setting the global setting to the default value should not impact a window
|
" Setting the global setting to the default value should not impact a window
|
||||||
" using a local setting
|
" using a local setting.
|
||||||
split
|
split
|
||||||
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
||||||
setglobal listchars=eol:$ " Accommodate Nvim default
|
setglobal listchars=eol:$ " Accommodate Nvim default
|
||||||
@ -449,7 +449,7 @@ func Test_listchars_window_local()
|
|||||||
call assert_equal(['^I one two $'], ScreenLines(1, virtcol('$')))
|
call assert_equal(['^I one two $'], ScreenLines(1, virtcol('$')))
|
||||||
|
|
||||||
" Setting the local setting to the default value should not impact a window
|
" Setting the local setting to the default value should not impact a window
|
||||||
" using a global setting
|
" using a global setting.
|
||||||
set listchars=tab:{.},lead:-,space:=,trail:#,eol:$
|
set listchars=tab:{.},lead:-,space:=,trail:#,eol:$
|
||||||
split
|
split
|
||||||
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
||||||
@ -460,7 +460,7 @@ func Test_listchars_window_local()
|
|||||||
call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
|
call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
|
||||||
|
|
||||||
" Using set in a window with a local setting should change it to use the
|
" Using set in a window with a local setting should change it to use the
|
||||||
" global setting and also impact other windows using the global setting
|
" global setting and also impact other windows using the global setting.
|
||||||
split
|
split
|
||||||
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
||||||
call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
|
call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
|
||||||
@ -470,7 +470,7 @@ func Test_listchars_window_local()
|
|||||||
call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
|
call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
|
||||||
|
|
||||||
" Setting invalid value for a local setting should not impact the local and
|
" Setting invalid value for a local setting should not impact the local and
|
||||||
" global settings
|
" global settings.
|
||||||
split
|
split
|
||||||
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
||||||
let cmd = 'setlocal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
|
let cmd = 'setlocal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
|
||||||
@ -480,7 +480,7 @@ func Test_listchars_window_local()
|
|||||||
call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
|
call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
|
||||||
|
|
||||||
" Setting invalid value for a global setting should not impact the local and
|
" Setting invalid value for a global setting should not impact the local and
|
||||||
" global settings
|
" global settings.
|
||||||
split
|
split
|
||||||
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
|
||||||
let cmd = 'setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
|
let cmd = 'setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
|
||||||
@ -489,6 +489,12 @@ func Test_listchars_window_local()
|
|||||||
close
|
close
|
||||||
call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
|
call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
|
||||||
|
|
||||||
|
" Closing window with local lcs-multispace should not cause a memory leak.
|
||||||
|
setlocal listchars=multispace:---+
|
||||||
|
split
|
||||||
|
call s:CheckListCharsValue('multispace:---+')
|
||||||
|
close
|
||||||
|
|
||||||
%bw!
|
%bw!
|
||||||
set list& listchars&
|
set list& listchars&
|
||||||
endfunc
|
endfunc
|
||||||
|
@ -4750,6 +4750,8 @@ static void win_free(win_T *wp, tabpage_T *tp)
|
|||||||
clear_winopt(&wp->w_onebuf_opt);
|
clear_winopt(&wp->w_onebuf_opt);
|
||||||
clear_winopt(&wp->w_allbuf_opt);
|
clear_winopt(&wp->w_allbuf_opt);
|
||||||
|
|
||||||
|
xfree(wp->w_p_lcs_chars.multispace);
|
||||||
|
|
||||||
vars_clear(&wp->w_vars->dv_hashtab); // free all w: variables
|
vars_clear(&wp->w_vars->dv_hashtab); // free all w: variables
|
||||||
hash_init(&wp->w_vars->dv_hashtab);
|
hash_init(&wp->w_vars->dv_hashtab);
|
||||||
unref_var_dict(wp->w_vars);
|
unref_var_dict(wp->w_vars);
|
||||||
|
Loading…
Reference in New Issue
Block a user