diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-07 13:37:22 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-11-07 14:25:32 +0800 |
commit | c00d241981f292a6529242bb98ed16cfc8c53ae4 (patch) | |
tree | a03acfc293cc5bfc0d78c4d8c6a0b847d37e95d7 /src/nvim/quickfix.c | |
parent | 8f9ae5278464205004c421e49dad640808b2256f (diff) | |
download | rneovim-c00d241981f292a6529242bb98ed16cfc8c53ae4.tar.gz rneovim-c00d241981f292a6529242bb98ed16cfc8c53ae4.tar.bz2 rneovim-c00d241981f292a6529242bb98ed16cfc8c53ae4.zip |
vim-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 vim/vim#9330)
https://github.com/vim/vim/commit/6ae8fae8696623b527c7fb22567f6a3705b2f0dd
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 5d101ee415..7ecb4e4956 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -6686,7 +6686,8 @@ int set_errorlist(win_T *wp, list_T *list, int action, char *title, dict_T *what return retval; } -/// 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 bool mark_quickfix_ctx(qf_info_T *qi, int copyID) { bool abort = false; @@ -6695,8 +6696,11 @@ static bool mark_quickfix_ctx(qf_info_T *qi, int copyID) typval_T *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); } + + Callback *cb = &qi->qf_lists[i].qf_qftf_cb; + abort = abort || set_ref_in_callback(cb, copyID, NULL, NULL); } return abort; @@ -6711,6 +6715,11 @@ bool set_ref_in_quickfix(int copyID) return abort; } + abort = set_ref_in_callback(&qftf_cb, copyID, NULL, NULL); + if (abort) { + return abort; + } + FOR_ALL_TAB_WINDOWS(tp, win) { if (win->w_llist != NULL) { abort = mark_quickfix_ctx(win->w_llist, copyID); |