0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 7.4.1322

Problem:    Crash when unletting the variable that holds the channel in a
            callback function.  (Christian Robinson)
Solution:   Increase the reference count while invoking the callback.
This commit is contained in:
Bram Moolenaar
2016-02-15 20:39:46 +01:00
parent 71b0f7b5c0
commit 3bece9fee9
5 changed files with 53 additions and 9 deletions

View File

@@ -7730,12 +7730,21 @@ failret:
return OK;
}
#ifdef FEAT_CHANNEL
static void
#if defined(FEAT_CHANNEL) || defined(PROTO)
/*
* Decrement the reference count on "channel" and free it when it goes down to
* zero.
* Returns TRUE when the channel was freed.
*/
int
channel_unref(channel_T *channel)
{
if (channel != NULL && --channel->ch_refcount <= 0)
{
channel_free(channel);
return TRUE;
}
return FALSE;
}
#endif