Mercurial > vim
diff src/quickfix.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 | c0cb28384dc2 |
children | fac6673086df |
line wrap: on
line diff
--- a/src/quickfix.c +++ b/src/quickfix.c @@ -7675,7 +7675,8 @@ set_errorlist( } /* - * Mark the context as in use for all the lists in a quickfix stack. + * Mark the quickfix context and callback function as in use for all the lists + * in a quickfix stack. */ static int mark_quickfix_ctx(qf_info_T *qi, int copyID) @@ -7683,13 +7684,17 @@ mark_quickfix_ctx(qf_info_T *qi, int cop int i; int abort = FALSE; typval_T *ctx; + callback_T *cb; for (i = 0; i < LISTCOUNT && !abort; ++i) { ctx = qi->qf_lists[i].qf_ctx; if (ctx != NULL && ctx->v_type != VAR_NUMBER && ctx->v_type != VAR_STRING && ctx->v_type != VAR_FLOAT) - abort = set_ref_in_item(ctx, copyID, NULL, NULL); + abort = abort || set_ref_in_item(ctx, copyID, NULL, NULL); + + cb = &qi->qf_lists[i].qftf_cb; + abort = abort || set_ref_in_callback(cb, copyID); } return abort; @@ -7710,6 +7715,10 @@ set_ref_in_quickfix(int copyID) if (abort) return abort; + abort = set_ref_in_callback(&qftf_cb, copyID); + if (abort) + return abort; + FOR_ALL_TAB_WINDOWS(tp, win) { if (win->w_llist != NULL)