diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-12-12 16:26:44 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-12 16:26:44 +0000 |
commit | 6ae8fae8696623b527c7fb22567f6a3705b2f0dd (patch) | |
tree | 5013ad6590516571ae06f992906c4270d7f03b45 /src/insexpand.c | |
parent | 6e371ecb27227ff8fedd8561d0f3880a17576848 (diff) |
patch 8.2.3788: lambda for option that is a function may be freedv8.2.3788
Problem: Lambda for option that is a function may be garbage collected.
Solution: Set a reference in the funcref. (Yegappan Lakshmanan,
closes #9330)
Diffstat (limited to 'src/insexpand.c')
-rw-r--r-- | src/insexpand.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/insexpand.c b/src/insexpand.c index 8c09841f00..bc490b9648 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -2341,6 +2341,21 @@ set_thesaurusfunc_option(void) return retval; } +/* + * Mark the global 'completefunc' 'omnifunc' and 'thesaurusfunc' callbacks with + * 'copyID' so that they are not garbage collected. + */ + int +set_ref_in_insexpand_funcs(int copyID) +{ + int abort = FALSE; + + abort = set_ref_in_callback(&cfu_cb, copyID); + abort = abort || set_ref_in_callback(&ofu_cb, copyID); + abort = abort || set_ref_in_callback(&tsrfu_cb, copyID); + + return abort; +} /* * Get the user-defined completion function name for completion 'type' |