comparison src/testdir/test_vim9_func.vim @ 26560:454a1c9ef797 v8.2.3809

patch 8.2.3809: Vim9: crash when garbage collecting a nested partial Commit: https://github.com/vim/vim/commit/7509ad8b0fad56f88288977decbeca3640406c82 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 14 18:14:37 2021 +0000 patch 8.2.3809: Vim9: crash when garbage collecting a nested partial Problem: Vim9: crash when garbage collecting a nested partial. (Virginia Senioria) Solution: Set references in all the funcstacks. (closes #9348)
author Bram Moolenaar <Bram@vim.org>
date Tue, 14 Dec 2021 19:15:04 +0100
parents dfa658800f21
children 7f90bde42bcc
comparison
equal deleted inserted replaced
26559:177872ca0db9 26560:454a1c9ef797
1901 assert_fails('so XToDelFunc', 'E933:', '', 1, 'CallGoneSoon') 1901 assert_fails('so XToDelFunc', 'E933:', '', 1, 'CallGoneSoon')
1902 1902
1903 delete('XToDelFunc') 1903 delete('XToDelFunc')
1904 enddef 1904 enddef
1905 1905
1906 func Test_free_dict_while_in_funcstack()
1907 " relies on the sleep command
1908 CheckUnix
1909 call Run_Test_free_dict_while_in_funcstack()
1910 endfunc
1911
1912 def Run_Test_free_dict_while_in_funcstack()
1913
1914 # this was freeing the TermRun() default argument dictionary while it was
1915 # still referenced in a funcstack_T
1916 var lines =<< trim END
1917 vim9script
1918
1919 &updatetime = 400
1920 def TermRun(_ = {})
1921 def Post()
1922 enddef
1923 def Exec()
1924 term_start('sleep 1', {
1925 term_finish: 'close',
1926 exit_cb: (_, _) => Post(),
1927 })
1928 enddef
1929 Exec()
1930 enddef
1931 nnoremap <F4> <Cmd>call <SID>TermRun()<CR>
1932 timer_start(100, (_) => feedkeys("\<F4>"))
1933 timer_start(1000, (_) => feedkeys("\<F4>"))
1934 sleep 1500m
1935 END
1936 CheckScriptSuccess(lines)
1937 nunmap <F4>
1938 set updatetime&
1939 enddef
1940
1906 def Test_redef_failure() 1941 def Test_redef_failure()
1907 writefile(['def Func0(): string', 'return "Func0"', 'enddef'], 'Xdef') 1942 writefile(['def Func0(): string', 'return "Func0"', 'enddef'], 'Xdef')
1908 so Xdef 1943 so Xdef
1909 writefile(['def Func1(): string', 'return "Func1"', 'enddef'], 'Xdef') 1944 writefile(['def Func1(): string', 'return "Func1"', 'enddef'], 'Xdef')
1910 so Xdef 1945 so Xdef