Mercurial > vim
comparison src/eval.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 | 4a1d2abc2016 |
children | 28745eec1dda |
comparison
equal
deleted
inserted
replaced
26517:7dfc4c45f698 | 26518:13ba00ef7687 |
---|---|
4514 abort = abort || garbage_collect_vimvars(copyID); | 4514 abort = abort || garbage_collect_vimvars(copyID); |
4515 | 4515 |
4516 // callbacks in buffers | 4516 // callbacks in buffers |
4517 abort = abort || set_ref_in_buffers(copyID); | 4517 abort = abort || set_ref_in_buffers(copyID); |
4518 | 4518 |
4519 // 'completefunc', 'omnifunc' and 'thesaurusfunc' callbacks | |
4520 abort = abort || set_ref_in_insexpand_funcs(copyID); | |
4521 | |
4522 // 'operatorfunc' callback | |
4523 abort = abort || set_ref_in_opfunc(copyID); | |
4524 | |
4525 // 'tagfunc' callback | |
4526 abort = abort || set_ref_in_tagfunc(copyID); | |
4527 | |
4528 // 'imactivatefunc' and 'imstatusfunc' callbacks | |
4529 abort = abort || set_ref_in_im_funcs(copyID); | |
4530 | |
4519 #ifdef FEAT_LUA | 4531 #ifdef FEAT_LUA |
4520 abort = abort || set_ref_in_lua(copyID); | 4532 abort = abort || set_ref_in_lua(copyID); |
4521 #endif | 4533 #endif |
4522 | 4534 |
4523 #ifdef FEAT_PYTHON | 4535 #ifdef FEAT_PYTHON |
4739 list_stack = list_stack->prev; | 4751 list_stack = list_stack->prev; |
4740 free(tempitem); | 4752 free(tempitem); |
4741 } | 4753 } |
4742 | 4754 |
4743 return abort; | 4755 return abort; |
4756 } | |
4757 | |
4758 /* | |
4759 * Mark the partial in callback 'cb' with "copyID". | |
4760 */ | |
4761 int | |
4762 set_ref_in_callback(callback_T *cb, int copyID) | |
4763 { | |
4764 typval_T tv; | |
4765 | |
4766 if (cb->cb_name == NULL || *cb->cb_name == NUL || cb->cb_partial == NULL) | |
4767 return FALSE; | |
4768 | |
4769 tv.v_type = VAR_PARTIAL; | |
4770 tv.vval.v_partial = cb->cb_partial; | |
4771 return set_ref_in_item(&tv, copyID, NULL, NULL); | |
4744 } | 4772 } |
4745 | 4773 |
4746 /* | 4774 /* |
4747 * Mark all lists and dicts referenced through typval "tv" with "copyID". | 4775 * Mark all lists and dicts referenced through typval "tv" with "copyID". |
4748 * "list_stack" is used to add lists to be marked. Can be NULL. | 4776 * "list_stack" is used to add lists to be marked. Can be NULL. |