0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 7.4.1322

Problem:    Crash when unletting the variable that holds the channel in a
            callback function.  (Christian Robinson)
Solution:   Increase the reference count while invoking the callback.
This commit is contained in:
Bram Moolenaar
2016-02-15 20:39:46 +01:00
parent 71b0f7b5c0
commit 3bece9fee9
5 changed files with 53 additions and 9 deletions

View File

@@ -295,3 +295,21 @@ func Test_pipe()
call job_stop(job)
endtry
endfunc
let s:unletResponse = ''
func s:UnletHandler(handle, msg)
let s:unletResponse = a:msg
unlet s:channelfd
endfunc
" Test that "unlet handle" in a handler doesn't crash Vim.
func s:unlet_handle(port)
let s:channelfd = ch_open('localhost:' . a:port, s:chopt)
call ch_sendexpr(s:channelfd, "test", function('s:UnletHandler'))
sleep 10m
call assert_equal('what?', s:unletResponse)
endfunc
func Test_unlet_handle()
call s:run_server('s:unlet_handle')
endfunc