aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-05-13 17:18:42 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-05-13 19:59:28 +0200
commit11b55aa004067be95a81b2d1a20634312d405c82 (patch)
treee81babf7160b0eb1b508e52a742ffd23e0b94dec /src/nvim/eval.c
parent36b2e3f743aaeb27531e67079d1a20bb4ac75e35 (diff)
downloadrneovim-11b55aa004067be95a81b2d1a20634312d405c82.tar.gz
rneovim-11b55aa004067be95a81b2d1a20634312d405c82.tar.bz2
rneovim-11b55aa004067be95a81b2d1a20634312d405c82.zip
timer: make sure to free callback after the last timer due callback
fixes #6974 Before this change, the partial could be freed before the last due callback got invoked, which caused a use-after-free when the due callback called the partial.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 126e9e0da9..a3540b3153 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -17039,7 +17039,8 @@ static void timer_stop(timer_T *timer)
time_watcher_close(&timer->tw, timer_close_cb);
}
-// invoked on next event loop tick, so queue is empty
+// This will be run on the main loop after the last timer_due_cb, so at this
+// point it is safe to free the callback.
static void timer_close_cb(TimeWatcher *tw, void *data)
{
timer_T *timer = (timer_T *)data;