comparison src/testdir/test_prompt_buffer.vim @ 17151:ebe9aab81898 v8.1.1575

patch 8.1.1575: callbacks may be garbage collected commit https://github.com/vim/vim/commit/75a1a9415b9c207de5a29b25c0d1949c6c9c5c61 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 20 03:45:36 2019 +0200 patch 8.1.1575: callbacks may be garbage collected Problem: Callbacks may be garbage collected. Solution: Set reference in callbacks. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/4564)
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Jun 2019 04:00:07 +0200
parents 8e9e9124c7a2
children 6d11a0d5751d
comparison
equal deleted inserted replaced
17150:96373bb9c0eb 17151:ebe9aab81898
100 call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))}) 100 call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
101 101
102 call StopVimInTerminal(buf) 102 call StopVimInTerminal(buf)
103 call delete(scriptName) 103 call delete(scriptName)
104 endfunc 104 endfunc
105
106 func Test_prompt_garbage_collect()
107 func MyPromptCallback(x, text)
108 " NOP
109 endfunc
110 func MyPromptInterrupt(x)
111 " NOP
112 endfunc
113
114 new
115 set buftype=prompt
116 call prompt_setcallback(bufnr(''), function('MyPromptCallback', [{}]))
117 call prompt_setinterrupt(bufnr(''), function('MyPromptInterrupt', [{}]))
118 call test_garbagecollect_now()
119 " Must not crash
120 call feedkeys("\<CR>\<C-C>", 'xt')
121 call assert_true(v:true)
122
123 delfunc MyPromptCallback
124 bwipe!
125 endfunc