Patch 7.4.1329
Problem:    Crash when using channel that failed to open.
Solution:   Check for NULL.  Update messages. (Yukihiro Nakadaira)
Files:      src/channel.c, src/eval.c, src/testdir/test_channel.vim


*** ../vim-7.4.1328/src/channel.c       2016-02-15 22:37:33.843330641 +0100
--- src/channel.c       2016-02-16 12:36:32.735158046 +0100
***************
*** 634,640 ****
            {
                /* Get here when the server can't be found. */
                ch_error(NULL, "Cannot connect to port after retry\n");
!               PERROR(_("E899: Cannot connect to port after retry2"));
                sock_close(sd);
                channel_free(channel);
                return NULL;
--- 634,640 ----
            {
                /* Get here when the server can't be found. */
                ch_error(NULL, "Cannot connect to port after retry\n");
!               PERROR(_("E899: Cannot connect to port after retry"));
                sock_close(sd);
                channel_free(channel);
                return NULL;
***************
*** 1220,1226 ****
      void
  channel_close(channel_T *channel)
  {
!     ch_log(channel, "Closing channel");
  
  #ifdef FEAT_GUI
      channel_gui_unregister(channel);
--- 1220,1226 ----
      void
  channel_close(channel_T *channel)
  {
!     ch_log(channel, "Closing channel\n");
  
  #ifdef FEAT_GUI
      channel_gui_unregister(channel);
*** ../vim-7.4.1328/src/eval.c  2016-02-15 22:37:33.839330683 +0100
--- src/eval.c  2016-02-16 12:41:24.492127066 +0100
***************
*** 21828,21834 ****
                channel_T *channel = varp->vval.v_channel;
                char      *status = channel_status(channel);
  
!               vim_snprintf((char *)buf, NUMBUFLEN,
                                     "channel %d %s", channel->ch_id, status);
                return buf;
            }
--- 21828,21837 ----
                channel_T *channel = varp->vval.v_channel;
                char      *status = channel_status(channel);
  
!               if (channel == NULL)
!                   vim_snprintf((char *)buf, NUMBUFLEN, "channel %s", status);
!               else
!                   vim_snprintf((char *)buf, NUMBUFLEN,
                                     "channel %d %s", channel->ch_id, status);
                return buf;
            }
***************
*** 22467,22473 ****
        case VAR_CHANNEL:
  #ifdef FEAT_CHANNEL
            to->vval.v_channel = from->vval.v_channel;
!           ++to->vval.v_channel->ch_refcount;
            break;
  #endif
        case VAR_STRING:
--- 22470,22477 ----
        case VAR_CHANNEL:
  #ifdef FEAT_CHANNEL
            to->vval.v_channel = from->vval.v_channel;
!           if (to->vval.v_channel != NULL)
!               ++to->vval.v_channel->ch_refcount;
            break;
  #endif
        case VAR_STRING:
*** ../vim-7.4.1328/src/testdir/test_channel.vim        2016-02-15 
22:55:22.552121091 +0100
--- src/testdir/test_channel.vim        2016-02-16 12:42:49.843240186 +0100
***************
*** 318,320 ****
--- 318,326 ----
  func Test_unlet_handle()
    call s:run_server('s:unlet_handle')
  endfunc
+ 
+ func Test_open_fail()
+   silent! let ch = ch_open("noserver")
+   echo ch
+   let d = ch
+ endfunc
*** ../vim-7.4.1328/src/version.c       2016-02-15 23:08:57.263566140 +0100
--- src/version.c       2016-02-16 12:33:02.745338913 +0100
***************
*** 749,750 ****
--- 749,752 ----
  {   /* Add new patch number below this line */
+ /**/
+     1329,
  /**/

-- 
GALAHAD:   Camelot ...
LAUNCELOT: Camelot ...
GAWAIN:    It's only a model.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui