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)
diff --git a/src/insexpand.c b/src/insexpand.c
index 8c09841..bc490b9 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -2341,6 +2341,21 @@
return retval;
}
+/*
+ * Mark the global 'completefunc' 'omnifunc' and 'thesaurusfunc' callbacks with
+ * 'copyID' so that they are not garbage collected.
+ */
+ int
+set_ref_in_insexpand_funcs(int copyID)
+{
+ int abort = FALSE;
+
+ abort = set_ref_in_callback(&cfu_cb, copyID);
+ abort = abort || set_ref_in_callback(&ofu_cb, copyID);
+ abort = abort || set_ref_in_callback(&tsrfu_cb, copyID);
+
+ return abort;
+}
/*
* Get the user-defined completion function name for completion 'type'