aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;