Skip to content

Commit 92e35ef

Browse files
committed
patch 7.4.1656
Problem: Crash when using partial with a timer. Solution: Increment partial reference count. (Hirohito Higashi)
1 parent 1e7885a commit 92e35ef

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/eval.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20190,6 +20190,7 @@ get_callback(typval_T *arg, partial_T **pp)
2019020190
if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
2019120191
{
2019220192
*pp = arg->vval.v_partial;
20193+
++(*pp)->pt_refcount;
2019320194
return (*pp)->pt_name;
2019420195
}
2019520196
*pp = NULL;

src/testdir/test_timers.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,16 @@ func Test_repeat_many()
3030
call assert_true(s:val > 1)
3131
call assert_true(s:val < 5)
3232
endfunc
33+
34+
func Test_with_partial_callback()
35+
let s:val = 0
36+
let s:meow = {}
37+
function s:meow.bite(...)
38+
let s:val += 1
39+
endfunction
40+
41+
call timer_start(50, s:meow.bite)
42+
sleep 200m
43+
call assert_equal(1, s:val)
44+
endfunc
45+
" vim: ts=2 sw=0 et

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1656,
751753
/**/
752754
1655,
753755
/**/

0 commit comments

Comments
 (0)