summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-25 23:10:17 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-25 23:10:17 +0100
commitc8dcbb12c5d7f3eb0c334daebb4475bb015b91e7 (patch)
tree1c59c8c123ad290f1753a0b38171fd9ad1fa3ebd /src/eval.c
parentd2227a02b03708eb0579e17612d5a96262f3d463 (diff)
downloadvim-c8dcbb12c5d7f3eb0c334daebb4475bb015b91e7.zip
patch 7.4.1421
Problem: May free a channel when a callback may need to be invoked. Solution: Keep the channel when refcount is zero.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c
index db9c6b754..0db6cfac5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7745,8 +7745,8 @@ failret:
#if defined(FEAT_CHANNEL) || defined(PROTO)
/*
- * Decrement the reference count on "channel" and free it when it goes down to
- * zero.
+ * Decrement the reference count on "channel" and maybe free it when it goes
+ * down to zero. Don't free it if there is a pending action.
* Returns TRUE when the channel was freed.
*/
int
@@ -7754,7 +7754,7 @@ channel_unref(channel_T *channel)
{
if (channel != NULL && --channel->ch_refcount <= 0)
{
- channel_free(channel);
+ channel_may_free(channel);
return TRUE;
}
return FALSE;