comparison src/evalbuffer.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 634aed775408
children 2df40c348c70
comparison
equal deleted inserted replaced
26517:7dfc4c45f698 26518:13ba00ef7687
24 buf_T *bp; 24 buf_T *bp;
25 25
26 FOR_ALL_BUFFERS(bp) 26 FOR_ALL_BUFFERS(bp)
27 { 27 {
28 listener_T *lnr; 28 listener_T *lnr;
29 typval_T tv;
30 29
31 for (lnr = bp->b_listener; !abort && lnr != NULL; lnr = lnr->lr_next) 30 for (lnr = bp->b_listener; !abort && lnr != NULL; lnr = lnr->lr_next)
32 { 31 abort = abort || set_ref_in_callback(&lnr->lr_callback, copyID);
33 if (lnr->lr_callback.cb_partial != NULL)
34 {
35 tv.v_type = VAR_PARTIAL;
36 tv.vval.v_partial = lnr->lr_callback.cb_partial;
37 abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL);
38 }
39 }
40 # ifdef FEAT_JOB_CHANNEL 32 # ifdef FEAT_JOB_CHANNEL
41 if (!abort && bp->b_prompt_callback.cb_partial != NULL) 33 if (!abort)
42 { 34 abort = abort || set_ref_in_callback(&bp->b_prompt_callback, copyID);
43 tv.v_type = VAR_PARTIAL; 35 if (!abort)
44 tv.vval.v_partial = bp->b_prompt_callback.cb_partial; 36 abort = abort || set_ref_in_callback(&bp->b_prompt_interrupt, copyID);
45 abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL);
46 }
47 if (!abort && bp->b_prompt_interrupt.cb_partial != NULL)
48 {
49 tv.v_type = VAR_PARTIAL;
50 tv.vval.v_partial = bp->b_prompt_interrupt.cb_partial;
51 abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL);
52 }
53 # endif 37 # endif
38 #ifdef FEAT_COMPL_FUNC
39 if (!abort)
40 abort = abort || set_ref_in_callback(&bp->b_cfu_cb, copyID);
41 if (!abort)
42 abort = abort || set_ref_in_callback(&bp->b_ofu_cb, copyID);
43 if (!abort)
44 abort = abort || set_ref_in_callback(&bp->b_tsrfu_cb, copyID);
45 #endif
46 if (!abort)
47 abort = abort || set_ref_in_callback(&bp->b_tfu_cb, copyID);
54 if (abort) 48 if (abort)
55 break; 49 break;
56 } 50 }
57 return abort; 51 return abort;
58 } 52 }