mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 7.4.1656
Problem: Crash when using partial with a timer. Solution: Increment partial reference count. (Hirohito Higashi)
This commit is contained in:
@@ -20190,6 +20190,7 @@ get_callback(typval_T *arg, partial_T **pp)
|
|||||||
if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
|
if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
|
||||||
{
|
{
|
||||||
*pp = arg->vval.v_partial;
|
*pp = arg->vval.v_partial;
|
||||||
|
++(*pp)->pt_refcount;
|
||||||
return (*pp)->pt_name;
|
return (*pp)->pt_name;
|
||||||
}
|
}
|
||||||
*pp = NULL;
|
*pp = NULL;
|
||||||
|
@@ -30,3 +30,16 @@ func Test_repeat_many()
|
|||||||
call assert_true(s:val > 1)
|
call assert_true(s:val > 1)
|
||||||
call assert_true(s:val < 5)
|
call assert_true(s:val < 5)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_with_partial_callback()
|
||||||
|
let s:val = 0
|
||||||
|
let s:meow = {}
|
||||||
|
function s:meow.bite(...)
|
||||||
|
let s:val += 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call timer_start(50, s:meow.bite)
|
||||||
|
sleep 200m
|
||||||
|
call assert_equal(1, s:val)
|
||||||
|
endfunc
|
||||||
|
" vim: ts=2 sw=0 et
|
||||||
|
@@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1656,
|
||||||
/**/
|
/**/
|
||||||
1655,
|
1655,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user