Mercurial > vim
diff src/insexpand.c @ 26518:13ba00ef7687 v8.2.3788
patch 8.2.3788: lambda for option that is a function may be freed
Commit: https://github.com/vim/vim/commit/6ae8fae8696623b527c7fb22567f6a3705b2f0dd
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Dec 12 16:26:44 2021 +0000
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 #9330)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Dec 2021 17:30:04 +0100 |
parents | 65b4109a4297 |
children | 84d56c5b7f2b |
line wrap: on
line diff
--- 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'