comparison src/ops.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 74e706afae3f
children 8da90cdcec68
comparison
equal deleted inserted replaced
26517:7dfc4c45f698 26518:13ba00ef7687
3339 3339
3340 #if defined(EXITFREE) || defined(PROTO) 3340 #if defined(EXITFREE) || defined(PROTO)
3341 void 3341 void
3342 free_operatorfunc_option(void) 3342 free_operatorfunc_option(void)
3343 { 3343 {
3344 # ifdef FEAT_EVAL 3344 # ifdef FEAT_EVAL
3345 free_callback(&opfunc_cb); 3345 free_callback(&opfunc_cb);
3346 # endif 3346 # endif
3347 } 3347 }
3348 #endif 3348 #endif
3349
3350 /*
3351 * Mark the global 'operatorfunc' callback with 'copyID' so that it is not
3352 * garbage collected.
3353 */
3354 int
3355 set_ref_in_opfunc(int copyID UNUSED)
3356 {
3357 int abort = FALSE;
3358
3359 #ifdef FEAT_EVAL
3360 abort = set_ref_in_callback(&opfunc_cb, copyID);
3361 #endif
3362
3363 return abort;
3364 }
3349 3365
3350 /* 3366 /*
3351 * Handle the "g@" operator: call 'operatorfunc'. 3367 * Handle the "g@" operator: call 'operatorfunc'.
3352 */ 3368 */
3353 static void 3369 static void