diff src/channel.c @ 8240:60586ce747c4 v7.4.1413

commit https://github.com/vim/vim/commit/8b374215ccd35003b95ba1df8f12e03bf8a8adc3 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 24 20:43:06 2016 +0100 patch 7.4.1413 Problem: When calling ch_close() the close callback is invoked, even though the docs say it isn't. (Christian J. Robinson) Solution: Don't call the close callback.
author Christian Brabandt <cb@256bit.org>
date Wed, 24 Feb 2016 20:45:08 +0100
parents 4f0677020a43
children c4ffdda8cdfd
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -312,7 +312,7 @@ add_channel(void)
     void
 channel_free(channel_T *channel)
 {
-    channel_close(channel);
+    channel_close(channel, TRUE);
     if (channel->ch_next != NULL)
 	channel->ch_next->ch_prev = channel->ch_prev;
     if (channel->ch_prev == NULL)
@@ -1466,7 +1466,7 @@ channel_status(channel_T *channel)
  * This does not trigger the close callback.
  */
     void
-channel_close(channel_T *channel)
+channel_close(channel_T *channel, int invoke_close_cb)
 {
     ch_log(channel, "Closing channel");
 
@@ -1497,7 +1497,7 @@ channel_close(channel_T *channel)
     }
 #endif
 
-    if (channel->ch_close_cb != NULL)
+    if (invoke_close_cb && channel->ch_close_cb != NULL)
     {
 	  typval_T	argv[1];
 	  typval_T	rettv;
@@ -1757,7 +1757,7 @@ channel_read(channel_T *channel, int par
 	/* TODO: When reading from stdout is not possible, should we try to
 	 * keep stdin and stderr open?  Probably not, assume the other side
 	 * has died. */
-	channel_close(channel);
+	channel_close(channel, TRUE);
 	if (channel->ch_nb_close_cb != NULL)
 	    (*channel->ch_nb_close_cb)();