comparison src/tag.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 08e3eee541ac
children 06a137af96f8
comparison
equal deleted inserted replaced
26517:7dfc4c45f698 26518:13ba00ef7687
131 #endif 131 #endif
132 132
133 return OK; 133 return OK;
134 } 134 }
135 135
136 # if defined(EXITFREE) || defined(PROTO) 136 #if defined(EXITFREE) || defined(PROTO)
137 void 137 void
138 free_tagfunc_option(void) 138 free_tagfunc_option(void)
139 { 139 {
140 # ifdef FEAT_EVAL 140 # ifdef FEAT_EVAL
141 free_callback(&tfu_cb); 141 free_callback(&tfu_cb);
142 # endif 142 # endif
143 } 143 }
144 # endif 144 #endif
145
146 /*
147 * Mark the global 'tagfunc' callback with 'copyID' so that it is not garbage
148 * collected.
149 */
150 int
151 set_ref_in_tagfunc(int copyID UNUSED)
152 {
153 int abort = FALSE;
154
155 #ifdef FEAT_EVAL
156 abort = set_ref_in_callback(&tfu_cb, copyID);
157 #endif
158
159 return abort;
160 }
145 161
146 /* 162 /*
147 * Copy the global 'tagfunc' callback function to the buffer-local 'tagfunc' 163 * Copy the global 'tagfunc' callback function to the buffer-local 'tagfunc'
148 * callback for 'buf'. 164 * callback for 'buf'.
149 */ 165 */