From b7dab423ef9b4b8b4493a519b6b715e826b6fbc8 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Wed, 9 Sep 2015 07:59:54 -0300 Subject: eval: Fix `ex_delfunction` to use the `uf_refcount` field properly @4b98ea1e80bf changed how refcounts are handled internally to fit into job control semantics. Change the refcount check in `ex_delfunction` to consider this. Close #3000 --- src/nvim/eval.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index bbe45480d2..9e61afa53d 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19832,7 +19832,9 @@ void ex_delfunction(exarg_T *eap) EMSG2(_("E131: Cannot delete function %s: It is in use"), eap->arg); return; } - if (fp->uf_refcount > 1) { + // check `uf_refcount > 2` because deleting a function should also reduce + // the reference count, and 1 is the initial refcount. + if (fp->uf_refcount > 2) { EMSG2(_("Cannot delete function %s: It is being used internally"), eap->arg); return; -- cgit