aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tag.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-07 13:37:22 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-07 14:25:32 +0800
commitc00d241981f292a6529242bb98ed16cfc8c53ae4 (patch)
treea03acfc293cc5bfc0d78c4d8c6a0b847d37e95d7 /src/nvim/tag.c
parent8f9ae5278464205004c421e49dad640808b2256f (diff)
downloadrneovim-c00d241981f292a6529242bb98ed16cfc8c53ae4.tar.gz
rneovim-c00d241981f292a6529242bb98ed16cfc8c53ae4.tar.bz2
rneovim-c00d241981f292a6529242bb98ed16cfc8c53ae4.zip
vim-patch:8.2.3788: lambda for option that is a function may be freed
Problem: Lambda for option that is a function may be garbage collected. Solution: Set a reference in the funcref. (Yegappan Lakshmanan, closes vim/vim#9330) https://github.com/vim/vim/commit/6ae8fae8696623b527c7fb22567f6a3705b2f0dd Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/tag.c')
-rw-r--r--src/nvim/tag.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index d57bbead63..9ea0b71dc1 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -149,6 +149,13 @@ void free_tagfunc_option(void)
}
#endif
+/// Mark the global 'tagfunc' callback with "copyID" so that it is not garbage
+/// collected.
+bool set_ref_in_tagfunc(int copyID)
+{
+ return set_ref_in_callback(&tfu_cb, copyID, NULL, NULL);
+}
+
/// Copy the global 'tagfunc' callback function to the buffer-local 'tagfunc'
/// callback for 'buf'.
void set_buflocal_tfu_callback(buf_T *buf)