summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-09-10 19:17:42 +0200
committerBram Moolenaar <Bram@vim.org>2016-09-10 19:17:42 +0200
commitee39ef0b93d31763d05e54ba99801e3f1a254c0d (patch)
tree365f8dbee248b74e8f305e78d865f3e43fb2a8fd /src/ex_cmds2.c
parent80c3fd7c559c7d329d57afe10db9bfb0adf10e46 (diff)
patch 7.4.2361v7.4.2361
Problem: Checking for last_timer_id to overflow is not reliable. (Ozaki Kiichi) Solution: Check for the number not going up.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 8df67536c5..b8d8dca9e0 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1143,10 +1143,11 @@ free_timer(timer_T *timer)
create_timer(long msec, int repeat)
{
timer_T *timer = (timer_T *)alloc_clear(sizeof(timer_T));
+ long prev_id = last_timer_id;
if (timer == NULL)
return NULL;
- if (++last_timer_id < 0)
+ if (++last_timer_id <= prev_id)
/* Overflow! Might cause duplicates... */
last_timer_id = 0;
timer->tr_id = last_timer_id;