Patch 8.2.3572
Problem:    Memory leak when closing window and using "multispace" in
            'listchars'.
Solution:   Free the memory. (closes #9071)
Files:      src/window.c, src/testdir/test_listchars.vim


*** ../vim-8.2.3571/src/window.c        2021-08-09 18:59:01.446811234 +0100
--- src/window.c        2021-11-02 20:32:08.035118499 +0000
***************
*** 5041,5046 ****
--- 5041,5048 ----
      clear_winopt(&wp->w_onebuf_opt);
      clear_winopt(&wp->w_allbuf_opt);
  
+     vim_free(wp->w_lcs_chars.multispace);
+ 
  #ifdef FEAT_EVAL
      vars_clear(&wp->w_vars->dv_hashtab);      // free all w: variables
      hash_init(&wp->w_vars->dv_hashtab);
*** ../vim-8.2.3571/src/testdir/test_listchars.vim      2021-10-16 
17:51:08.047842118 +0100
--- src/testdir/test_listchars.vim      2021-11-02 20:33:42.455749292 +0000
***************
*** 445,451 ****
    call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
  
    " Setting the global setting to the default value should not impact a window
!   " using a local setting
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
    setglobal listchars&vim
--- 445,451 ----
    call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
  
    " Setting the global setting to the default value should not impact a window
!   " using a local setting.
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
    setglobal listchars&vim
***************
*** 454,460 ****
    call assert_equal(['^I  one  two  $'], ScreenLines(1, virtcol('$')))
  
    " Setting the local setting to the default value should not impact a window
!   " using a global setting
    set listchars=tab:{.},lead:-,space:=,trail:#,eol:$
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
--- 454,460 ----
    call assert_equal(['^I  one  two  $'], ScreenLines(1, virtcol('$')))
  
    " Setting the local setting to the default value should not impact a window
!   " using a global setting.
    set listchars=tab:{.},lead:-,space:=,trail:#,eol:$
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
***************
*** 465,471 ****
    call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
  
    " 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
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
    call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
--- 465,471 ----
    call assert_equal(['{......}--one==two##$'], ScreenLines(1, virtcol('$')))
  
    " 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.
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
    call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
***************
*** 475,481 ****
    call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
  
    " Setting invalid value for a local setting should not impact the local and
!   " global settings
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
    let cmd = 'setlocal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
--- 475,481 ----
    call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
  
    " Setting invalid value for a local setting should not impact the local and
!   " global settings.
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
    let cmd = 'setlocal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
***************
*** 485,491 ****
    call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
  
    " Setting invalid value for a global setting should not impact the local and
!   " global settings
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
    let cmd = 'setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
--- 485,491 ----
    call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
  
    " Setting invalid value for a global setting should not impact the local and
!   " global settings.
    split
    setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
    let cmd = 'setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
***************
*** 494,499 ****
--- 494,505 ----
    close
    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!
    set list& listchars&
  endfunc
*** ../vim-8.2.3571/src/version.c       2021-11-02 20:24:34.980003926 +0000
--- src/version.c       2021-11-02 20:42:46.736681089 +0000
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3572,
  /**/

-- 
Facepalm statement #5: "Petrol getting more expensive?  Not for me, I'm always
tanking for 20 dollars"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211102205641.2938AC80055%40moolenaar.net.

Raspunde prin e-mail lui