From: Bram Moolenaar Date: Sat, 26 Mar 2016 17:20:41 +0000 (+0100) Subject: patch 7.4.1656 X-Git-Tag: v7.4.1656 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=92e35efaf6a3278e4729115648997f09cd4005f5;p=vim patch 7.4.1656 Problem: Crash when using partial with a timer. Solution: Increment partial reference count. (Hirohito Higashi) --- diff --git a/src/eval.c b/src/eval.c index 225658921..06f3585b3 100644 --- a/src/eval.c +++ b/src/eval.c @@ -20190,6 +20190,7 @@ get_callback(typval_T *arg, partial_T **pp) if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL) { *pp = arg->vval.v_partial; + ++(*pp)->pt_refcount; return (*pp)->pt_name; } *pp = NULL; diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim index 9f58a3590..7ef51e5b5 100644 --- a/src/testdir/test_timers.vim +++ b/src/testdir/test_timers.vim @@ -30,3 +30,16 @@ func Test_repeat_many() call assert_true(s:val > 1) call assert_true(s:val < 5) 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 diff --git a/src/version.c b/src/version.c index a3d6e1eeb..28ac3e5d8 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1656, /**/ 1655, /**/