comparison src/eval.c @ 8055:6db4b1c863ec v7.4.1322

commit https://github.com/vim/vim/commit/3bece9fee9c02934d3e295b29d253e13d4ef26a7 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 15 20:39:46 2016 +0100 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.
author Christian Brabandt <cb@256bit.org>
date Mon, 15 Feb 2016 20:45:04 +0100
parents 7c74cafac0a1
children 7fe3b9dc132b
comparison
equal deleted inserted replaced
8054:adb3150edaaf 8055:6db4b1c863ec
7728 } 7728 }
7729 7729
7730 return OK; 7730 return OK;
7731 } 7731 }
7732 7732
7733 #ifdef FEAT_CHANNEL 7733 #if defined(FEAT_CHANNEL) || defined(PROTO)
7734 static void 7734 /*
7735 * Decrement the reference count on "channel" and free it when it goes down to
7736 * zero.
7737 * Returns TRUE when the channel was freed.
7738 */
7739 int
7735 channel_unref(channel_T *channel) 7740 channel_unref(channel_T *channel)
7736 { 7741 {
7737 if (channel != NULL && --channel->ch_refcount <= 0) 7742 if (channel != NULL && --channel->ch_refcount <= 0)
7743 {
7738 channel_free(channel); 7744 channel_free(channel);
7745 return TRUE;
7746 }
7747 return FALSE;
7739 } 7748 }
7740 #endif 7749 #endif
7741 7750
7742 #ifdef FEAT_JOB 7751 #ifdef FEAT_JOB
7743 static void 7752 static void