patch 8.1.1575: callbacks may be garbage collected
Problem: Callbacks may be garbage collected.
Solution: Set reference in callbacks. (Ozaki Kiichi, closes #4564)
diff --git a/src/channel.c b/src/channel.c
index 76c5611..4e6df94 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -4479,7 +4479,8 @@
channel_T *channel;
typval_T tv;
- for (channel = first_channel; channel != NULL; channel = channel->ch_next)
+ for (channel = first_channel; !abort && channel != NULL;
+ channel = channel->ch_next)
if (channel_still_useful(channel))
{
tv.v_type = VAR_CHANNEL;
@@ -5568,7 +5569,7 @@
job_T *job;
typval_T tv;
- for (job = first_job; job != NULL; job = job->jv_next)
+ for (job = first_job; !abort && job != NULL; job = job->jv_next)
if (job_still_useful(job))
{
tv.v_type = VAR_JOB;