0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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.
This commit is contained in:
Bram Moolenaar
2016-02-24 20:43:06 +01:00
parent 68c85fcdf3
commit 8b374215cc
5 changed files with 9 additions and 7 deletions

View File

@@ -312,7 +312,7 @@ add_channel(void)
void void
channel_free(channel_T *channel) channel_free(channel_T *channel)
{ {
channel_close(channel); channel_close(channel, TRUE);
if (channel->ch_next != NULL) if (channel->ch_next != NULL)
channel->ch_next->ch_prev = channel->ch_prev; channel->ch_next->ch_prev = channel->ch_prev;
if (channel->ch_prev == NULL) if (channel->ch_prev == NULL)
@@ -1466,7 +1466,7 @@ channel_status(channel_T *channel)
* This does not trigger the close callback. * This does not trigger the close callback.
*/ */
void void
channel_close(channel_T *channel) channel_close(channel_T *channel, int invoke_close_cb)
{ {
ch_log(channel, "Closing channel"); ch_log(channel, "Closing channel");
@@ -1497,7 +1497,7 @@ channel_close(channel_T *channel)
} }
#endif #endif
if (channel->ch_close_cb != NULL) if (invoke_close_cb && channel->ch_close_cb != NULL)
{ {
typval_T argv[1]; typval_T argv[1];
typval_T rettv; typval_T rettv;
@@ -1757,7 +1757,7 @@ channel_read(channel_T *channel, int part, char *func)
/* TODO: When reading from stdout is not possible, should we try to /* TODO: When reading from stdout is not possible, should we try to
* keep stdin and stderr open? Probably not, assume the other side * keep stdin and stderr open? Probably not, assume the other side
* has died. */ * has died. */
channel_close(channel); channel_close(channel, TRUE);
if (channel->ch_nb_close_cb != NULL) if (channel->ch_nb_close_cb != NULL)
(*channel->ch_nb_close_cb)(); (*channel->ch_nb_close_cb)();

View File

@@ -10213,7 +10213,7 @@ f_ch_close(typval_T *argvars, typval_T *rettv UNUSED)
channel_T *channel = get_channel_arg(&argvars[0]); channel_T *channel = get_channel_arg(&argvars[0]);
if (channel != NULL) if (channel != NULL)
channel_close(channel); channel_close(channel, FALSE);
} }
# ifdef FEAT_JOB # ifdef FEAT_JOB

View File

@@ -100,7 +100,7 @@ netbeans_close(void)
netbeans_send_disconnect(); netbeans_send_disconnect();
if (nb_channel != NULL) if (nb_channel != NULL)
/* Close the socket and remove the input handlers. */ /* Close the socket and remove the input handlers. */
channel_close(nb_channel); channel_close(nb_channel, TRUE);
nb_channel = NULL; nb_channel = NULL;
} }

View File

@@ -17,7 +17,7 @@ int channel_collapse(channel_T *channel, int part);
int channel_can_write_to(channel_T *channel); int channel_can_write_to(channel_T *channel);
int channel_is_open(channel_T *channel); int channel_is_open(channel_T *channel);
char *channel_status(channel_T *channel); char *channel_status(channel_T *channel);
void channel_close(channel_T *channel); void channel_close(channel_T *channel, int invoke_close_cb);
char_u *channel_peek(channel_T *channel, int part); char_u *channel_peek(channel_T *channel, int part);
void channel_clear(channel_T *channel); void channel_clear(channel_T *channel);
void channel_free_all(void); void channel_free_all(void);

View File

@@ -748,6 +748,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1413,
/**/ /**/
1412, 1412,
/**/ /**/