comparison src/testdir/test_channel.vim @ 8055:6db4b1c863ec v7.4.1322

commit https://github.com/vim/vim/commit/3bece9fee9c02934d3e295b29d253e13d4ef26a7 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 15 20:39:46 2016 +0100 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.
author Christian Brabandt <cb@256bit.org>
date Mon, 15 Feb 2016 20:45:04 +0100
parents 9f9b74579bdc
children 19304db153bc
comparison
equal deleted inserted replaced
8054:adb3150edaaf 8055:6db4b1c863ec
293 call assert_equal("Goodbye!\n", reply) 293 call assert_equal("Goodbye!\n", reply)
294 finally 294 finally
295 call job_stop(job) 295 call job_stop(job)
296 endtry 296 endtry
297 endfunc 297 endfunc
298
299 let s:unletResponse = ''
300 func s:UnletHandler(handle, msg)
301 let s:unletResponse = a:msg
302 unlet s:channelfd
303 endfunc
304
305 " Test that "unlet handle" in a handler doesn't crash Vim.
306 func s:unlet_handle(port)
307 let s:channelfd = ch_open('localhost:' . a:port, s:chopt)
308 call ch_sendexpr(s:channelfd, "test", function('s:UnletHandler'))
309 sleep 10m
310 call assert_equal('what?', s:unletResponse)
311 endfunc
312
313 func Test_unlet_handle()
314 call s:run_server('s:unlet_handle')
315 endfunc