comparison 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
comparison
equal deleted inserted replaced
8239:6d17282085cd 8240:60586ce747c4
310 * Close a channel and free all its resources. 310 * Close a channel and free all its resources.
311 */ 311 */
312 void 312 void
313 channel_free(channel_T *channel) 313 channel_free(channel_T *channel)
314 { 314 {
315 channel_close(channel); 315 channel_close(channel, TRUE);
316 if (channel->ch_next != NULL) 316 if (channel->ch_next != NULL)
317 channel->ch_next->ch_prev = channel->ch_prev; 317 channel->ch_next->ch_prev = channel->ch_prev;
318 if (channel->ch_prev == NULL) 318 if (channel->ch_prev == NULL)
319 first_channel = channel->ch_next; 319 first_channel = channel->ch_next;
320 else 320 else
1464 /* 1464 /*
1465 * Close channel "channel". 1465 * Close channel "channel".
1466 * This does not trigger the close callback. 1466 * This does not trigger the close callback.
1467 */ 1467 */
1468 void 1468 void
1469 channel_close(channel_T *channel) 1469 channel_close(channel_T *channel, int invoke_close_cb)
1470 { 1470 {
1471 ch_log(channel, "Closing channel"); 1471 ch_log(channel, "Closing channel");
1472 1472
1473 #ifdef FEAT_GUI 1473 #ifdef FEAT_GUI
1474 channel_gui_unregister(channel); 1474 channel_gui_unregister(channel);
1495 fd_close(channel->CH_ERR_FD); 1495 fd_close(channel->CH_ERR_FD);
1496 channel->CH_ERR_FD = INVALID_FD; 1496 channel->CH_ERR_FD = INVALID_FD;
1497 } 1497 }
1498 #endif 1498 #endif
1499 1499
1500 if (channel->ch_close_cb != NULL) 1500 if (invoke_close_cb && channel->ch_close_cb != NULL)
1501 { 1501 {
1502 typval_T argv[1]; 1502 typval_T argv[1];
1503 typval_T rettv; 1503 typval_T rettv;
1504 int dummy; 1504 int dummy;
1505 1505
1755 channel_save(channel, part, (char_u *)msg, (int)STRLEN(msg)); 1755 channel_save(channel, part, (char_u *)msg, (int)STRLEN(msg));
1756 1756
1757 /* TODO: When reading from stdout is not possible, should we try to 1757 /* TODO: When reading from stdout is not possible, should we try to
1758 * keep stdin and stderr open? Probably not, assume the other side 1758 * keep stdin and stderr open? Probably not, assume the other side
1759 * has died. */ 1759 * has died. */
1760 channel_close(channel); 1760 channel_close(channel, TRUE);
1761 if (channel->ch_nb_close_cb != NULL) 1761 if (channel->ch_nb_close_cb != NULL)
1762 (*channel->ch_nb_close_cb)(); 1762 (*channel->ch_nb_close_cb)();
1763 1763
1764 if (len < 0) 1764 if (len < 0)
1765 { 1765 {