Skip to content

Commit 8b37421

Browse files
committed
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.
1 parent 68c85fc commit 8b37421

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

src/channel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ add_channel(void)
312312
void
313313
channel_free(channel_T *channel)
314314
{
315-
channel_close(channel);
315+
channel_close(channel, TRUE);
316316
if (channel->ch_next != NULL)
317317
channel->ch_next->ch_prev = channel->ch_prev;
318318
if (channel->ch_prev == NULL)
@@ -1466,7 +1466,7 @@ channel_status(channel_T *channel)
14661466
* This does not trigger the close callback.
14671467
*/
14681468
void
1469-
channel_close(channel_T *channel)
1469+
channel_close(channel_T *channel, int invoke_close_cb)
14701470
{
14711471
ch_log(channel, "Closing channel");
14721472

@@ -1497,7 +1497,7 @@ channel_close(channel_T *channel)
14971497
}
14981498
#endif
14991499

1500-
if (channel->ch_close_cb != NULL)
1500+
if (invoke_close_cb && channel->ch_close_cb != NULL)
15011501
{
15021502
typval_T argv[1];
15031503
typval_T rettv;
@@ -1757,7 +1757,7 @@ channel_read(channel_T *channel, int part, char *func)
17571757
/* TODO: When reading from stdout is not possible, should we try to
17581758
* keep stdin and stderr open? Probably not, assume the other side
17591759
* has died. */
1760-
channel_close(channel);
1760+
channel_close(channel, TRUE);
17611761
if (channel->ch_nb_close_cb != NULL)
17621762
(*channel->ch_nb_close_cb)();
17631763

src/eval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10213,7 +10213,7 @@ f_ch_close(typval_T *argvars, typval_T *rettv UNUSED)
1021310213
channel_T *channel = get_channel_arg(&argvars[0]);
1021410214

1021510215
if (channel != NULL)
10216-
channel_close(channel);
10216+
channel_close(channel, FALSE);
1021710217
}
1021810218

1021910219
# ifdef FEAT_JOB

src/netbeans.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ netbeans_close(void)
100100
netbeans_send_disconnect();
101101
if (nb_channel != NULL)
102102
/* Close the socket and remove the input handlers. */
103-
channel_close(nb_channel);
103+
channel_close(nb_channel, TRUE);
104104
nb_channel = NULL;
105105
}
106106

src/proto/channel.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int channel_collapse(channel_T *channel, int part);
1717
int channel_can_write_to(channel_T *channel);
1818
int channel_is_open(channel_T *channel);
1919
char *channel_status(channel_T *channel);
20-
void channel_close(channel_T *channel);
20+
void channel_close(channel_T *channel, int invoke_close_cb);
2121
char_u *channel_peek(channel_T *channel, int part);
2222
void channel_clear(channel_T *channel);
2323
void channel_free_all(void);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1413,
751753
/**/
752754
1412,
753755
/**/

0 commit comments

Comments
 (0)