diff src/ex_cmds2.c @ 9153:c2fe86f2bda1 v7.4.1860

commit https://github.com/vim/vim/commit/e3188e261569ae512fb1ae2653b57fdd9e259ca3 Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 31 21:13:04 2016 +0200 patch 7.4.1860 Problem: Using a partial for timer_start() may cause a crash. Solution: Set the copyID in timer objects. (Ozaki Kiichi)
author Christian Brabandt <cb@256bit.org>
date Tue, 31 May 2016 21:15:06 +0200
parents 932f94b2d8c2
children e4d7e6d1a0f1
line wrap: on
line diff
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1252,6 +1252,25 @@ stop_timer(timer_T *timer)
     remove_timer(timer);
     free_timer(timer);
 }
+
+/*
+ * Mark references in partials of timers.
+ */
+    int
+set_ref_in_timer(int copyID)
+{
+    int		abort = FALSE;
+    timer_T	*timer;
+    typval_T	tv;
+
+    for (timer = first_timer; timer != NULL; timer = timer->tr_next)
+    {
+	tv.v_type = VAR_PARTIAL;
+	tv.vval.v_partial = timer->tr_partial;
+	abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL);
+    }
+    return abort;
+}
 # endif
 
 #if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT)