summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-12-12 16:26:44 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-12 16:26:44 +0000
commit6ae8fae8696623b527c7fb22567f6a3705b2f0dd (patch)
tree5013ad6590516571ae06f992906c4270d7f03b45 /src/quickfix.c
parent6e371ecb27227ff8fedd8561d0f3880a17576848 (diff)
downloadvim-git-6ae8fae8696623b527c7fb22567f6a3705b2f0dd.tar.gz
patch 8.2.3788: lambda for option that is a function may be freedv8.2.3788
Problem: Lambda for option that is a function may be garbage collected. Solution: Set a reference in the funcref. (Yegappan Lakshmanan, closes #9330)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index c7abc8ec4..eeee8068d 100644
--- 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 copyID)
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)