aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-09-09 07:59:54 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-09-18 14:35:26 -0300
commitb7dab423ef9b4b8b4493a519b6b715e826b6fbc8 (patch)
treee8c973c91cbd96031f454c5b44618eb99578d9ae /src/nvim/eval.c
parent0a116c828debc6192a6bfb6bceb8cf020e867db0 (diff)
downloadrneovim-b7dab423ef9b4b8b4493a519b6b715e826b6fbc8.tar.gz
rneovim-b7dab423ef9b4b8b4493a519b6b715e826b6fbc8.tar.bz2
rneovim-b7dab423ef9b4b8b4493a519b6b715e826b6fbc8.zip
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
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c4
1 files changed, 3 insertions, 1 deletions
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;