mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
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)
6ae8fae869
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -5606,6 +5606,13 @@ void free_operatorfunc_option(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Mark the global 'operatorfunc' callback with "copyID" so that it is not
|
||||
/// garbage collected.
|
||||
bool set_ref_in_opfunc(int copyID)
|
||||
{
|
||||
return set_ref_in_callback(&opfunc_cb, copyID, NULL, NULL);
|
||||
}
|
||||
|
||||
/// Handle the "g@" operator: call 'operatorfunc'.
|
||||
static void op_function(const oparg_T *oap)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
|
Reference in New Issue
Block a user