summaryrefslogtreecommitdiff
path: root/src/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/channel.c b/src/channel.c
index 3b8b5afa0..5ee05e333 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -1124,15 +1124,18 @@ set_callback(
if (callback != NULL && *callback != NUL)
{
if (partial != NULL)
- *cbp = partial->pt_name;
+ *cbp = partial_name(partial);
else
+ {
*cbp = vim_strsave(callback);
+ func_ref(*cbp);
+ }
}
else
*cbp = NULL;
*pp = partial;
- if (*pp != NULL)
- ++(*pp)->pt_refcount;
+ if (partial != NULL)
+ ++partial->pt_refcount;
}
/*
@@ -1279,7 +1282,10 @@ channel_set_req_callback(
item->cq_callback = callback;
}
else
+ {
item->cq_callback = vim_strsave(callback);
+ func_ref(item->cq_callback);
+ }
item->cq_seq_nr = id;
item->cq_prev = head->cq_prev;
head->cq_prev = item;
@@ -3923,14 +3929,24 @@ free_job_options(jobopt_T *opt)
{
if (opt->jo_partial != NULL)
partial_unref(opt->jo_partial);
+ else if (opt->jo_callback != NULL)
+ func_unref(opt->jo_callback);
if (opt->jo_out_partial != NULL)
partial_unref(opt->jo_out_partial);
+ else if (opt->jo_out_cb != NULL)
+ func_unref(opt->jo_out_cb);
if (opt->jo_err_partial != NULL)
partial_unref(opt->jo_err_partial);
+ else if (opt->jo_err_cb != NULL)
+ func_unref(opt->jo_err_cb);
if (opt->jo_close_partial != NULL)
partial_unref(opt->jo_close_partial);
+ else if (opt->jo_close_cb != NULL)
+ func_unref(opt->jo_close_cb);
if (opt->jo_exit_partial != NULL)
partial_unref(opt->jo_exit_partial);
+ else if (opt->jo_exit_cb != NULL)
+ func_unref(opt->jo_exit_cb);
}
/*
@@ -4476,7 +4492,10 @@ job_set_options(job_T *job, jobopt_T *opt)
++job->jv_exit_partial->pt_refcount;
}
else
+ {
job->jv_exit_cb = vim_strsave(opt->jo_exit_cb);
+ func_ref(job->jv_exit_cb);
+ }
}
}
}