To: vim_dev@googlegroups.com Subject: Patch 7.4.1413 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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. Files: src/eval.c, src/channel.c, src/netbeans.c, src/proto/channel.pro *** ../vim-7.4.1412/src/eval.c 2016-02-23 22:07:28.164881439 +0100 --- src/eval.c 2016-02-24 20:37:30.508962367 +0100 *************** *** 10213,10219 **** channel_T *channel = get_channel_arg(&argvars[0]); if (channel != NULL) ! channel_close(channel); } # ifdef FEAT_JOB --- 10213,10219 ---- channel_T *channel = get_channel_arg(&argvars[0]); if (channel != NULL) ! channel_close(channel, FALSE); } # ifdef FEAT_JOB *** ../vim-7.4.1412/src/channel.c 2016-02-23 19:33:57.421544921 +0100 --- src/channel.c 2016-02-24 20:37:16.305109742 +0100 *************** *** 312,318 **** void channel_free(channel_T *channel) { ! channel_close(channel); if (channel->ch_next != NULL) channel->ch_next->ch_prev = channel->ch_prev; if (channel->ch_prev == NULL) --- 312,318 ---- void channel_free(channel_T *channel) { ! channel_close(channel, TRUE); if (channel->ch_next != NULL) channel->ch_next->ch_prev = channel->ch_prev; if (channel->ch_prev == NULL) *************** *** 1466,1472 **** * This does not trigger the close callback. */ void ! channel_close(channel_T *channel) { ch_log(channel, "Closing channel"); --- 1466,1472 ---- * This does not trigger the close callback. */ void ! channel_close(channel_T *channel, int invoke_close_cb) { ch_log(channel, "Closing channel"); *************** *** 1497,1503 **** } #endif ! if (channel->ch_close_cb != NULL) { typval_T argv[1]; typval_T rettv; --- 1497,1503 ---- } #endif ! if (invoke_close_cb && channel->ch_close_cb != NULL) { typval_T argv[1]; typval_T rettv; *************** *** 1757,1763 **** /* 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); if (channel->ch_nb_close_cb != NULL) (*channel->ch_nb_close_cb)(); --- 1757,1763 ---- /* 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, TRUE); if (channel->ch_nb_close_cb != NULL) (*channel->ch_nb_close_cb)(); *** ../vim-7.4.1412/src/netbeans.c 2016-02-23 17:13:56.885032246 +0100 --- src/netbeans.c 2016-02-24 20:37:39.612867904 +0100 *************** *** 100,106 **** netbeans_send_disconnect(); if (nb_channel != NULL) /* Close the socket and remove the input handlers. */ ! channel_close(nb_channel); nb_channel = NULL; } --- 100,106 ---- netbeans_send_disconnect(); if (nb_channel != NULL) /* Close the socket and remove the input handlers. */ ! channel_close(nb_channel, TRUE); nb_channel = NULL; } *** ../vim-7.4.1412/src/proto/channel.pro 2016-02-23 13:20:18.466462173 +0100 --- src/proto/channel.pro 2016-02-24 20:36:40.813477955 +0100 *************** *** 17,23 **** int channel_can_write_to(channel_T *channel); int channel_is_open(channel_T *channel); char *channel_status(channel_T *channel); ! void channel_close(channel_T *channel); char_u *channel_peek(channel_T *channel, int part); void channel_clear(channel_T *channel); void channel_free_all(void); --- 17,23 ---- int channel_can_write_to(channel_T *channel); int channel_is_open(channel_T *channel); char *channel_status(channel_T *channel); ! void channel_close(channel_T *channel, int invoke_close_cb); char_u *channel_peek(channel_T *channel, int part); void channel_clear(channel_T *channel); void channel_free_all(void); *** ../vim-7.4.1412/src/version.c 2016-02-24 12:57:46.460114833 +0100 --- src/version.c 2016-02-24 20:42:23.313929197 +0100 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1413, /**/ -- An indication you must be a manager: You feel sorry for Dilbert's boss. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///