Patch 8.1.0349
Problem:    Crash when wiping buffer in a callback.
Solution:   Do not handle messages when only peeking for a character.
            (closes #2107)  Add "redraw_flag" to test_override().
Files:      src/os_unix.c, src/os_win32.c, src/screen.c, src/evalfunc.c,
            src/globals.h, runtime/doc/eval.txt


*** ../vim-8.1.0348/src/os_unix.c       2018-08-27 23:24:13.064009239 +0200
--- src/os_unix.c       2018-09-06 13:12:40.441556794 +0200
***************
*** 417,426 ****
            handle_resize();
  
  #ifdef MESSAGE_QUEUE
!       parse_queued_messages();
!       /* If input was put directly in typeahead buffer bail out here. */
!       if (typebuf_changed(tb_change_cnt))
!           return 0;
  #endif
        if (wtime < 0 && did_start_blocking)
            /* blocking and already waited for p_ut */
--- 417,430 ----
            handle_resize();
  
  #ifdef MESSAGE_QUEUE
!       // Only process messages when waiting.
!       if (wtime != 0)
!       {
!           parse_queued_messages();
!           // If input was put directly in typeahead buffer bail out here.
!           if (typebuf_changed(tb_change_cnt))
!               return 0;
!       }
  #endif
        if (wtime < 0 && did_start_blocking)
            /* blocking and already waited for p_ut */
*** ../vim-8.1.0348/src/os_win32.c      2018-08-30 17:47:01.949560920 +0200
--- src/os_win32.c      2018-09-06 12:12:22.506417572 +0200
***************
*** 1529,1543 ****
       */
      for (;;)
      {
  #ifdef MESSAGE_QUEUE
!       parse_queued_messages();
  #endif
  #ifdef FEAT_MZSCHEME
!       mzvim_check_threads();
  #endif
  #ifdef FEAT_CLIENTSERVER
!       serverProcessPendingMessages();
  #endif
  
        if (0
  #ifdef FEAT_MOUSE
--- 1529,1547 ----
       */
      for (;;)
      {
+       // Only process messages when waiting.
+       if (msec != 0)
+       {
  #ifdef MESSAGE_QUEUE
!           parse_queued_messages();
  #endif
  #ifdef FEAT_MZSCHEME
!           mzvim_check_threads();
  #endif
  #ifdef FEAT_CLIENTSERVER
!           serverProcessPendingMessages();
  #endif
+       }
  
        if (0
  #ifdef FEAT_MOUSE
*** ../vim-8.1.0348/src/screen.c        2018-09-02 15:07:21.977655529 +0200
--- src/screen.c        2018-09-06 12:37:10.783837405 +0200
***************
*** 10819,10826 ****
        return 0;
      else
  #endif
!       return (!RedrawingDisabled
!                      && !(p_lz && char_avail() && !KeyTyped && !do_redraw));
  }
  
  /*
--- 10819,10829 ----
        return 0;
      else
  #endif
!       return ((!RedrawingDisabled
! #ifdef FEAT_EVAL
!                   || ignore_redraw_flag_for_testing
! #endif
!               ) && !(p_lz && char_avail() && !KeyTyped && !do_redraw));
  }
  
  /*
*** ../vim-8.1.0348/src/evalfunc.c      2018-09-02 14:25:02.330801508 +0200
--- src/evalfunc.c      2018-09-06 12:38:22.375337484 +0200
***************
*** 13073,13078 ****
--- 13073,13080 ----
  
        if (STRCMP(name, (char_u *)"redraw") == 0)
            disable_redraw_for_testing = val;
+       else if (STRCMP(name, (char_u *)"redraw_flag") == 0)
+           ignore_redraw_flag_for_testing = val;
        else if (STRCMP(name, (char_u *)"char_avail") == 0)
            disable_char_avail_for_testing = val;
        else if (STRCMP(name, (char_u *)"starting") == 0)
***************
*** 13095,13100 ****
--- 13097,13103 ----
        {
            disable_char_avail_for_testing = FALSE;
            disable_redraw_for_testing = FALSE;
+           ignore_redraw_flag_for_testing = FALSE;
            nfa_fail_for_testing = FALSE;
            if (save_starting >= 0)
            {
*** ../vim-8.1.0348/src/globals.h       2018-08-21 19:47:44.720053833 +0200
--- src/globals.h       2018-09-06 12:38:43.019189178 +0200
***************
*** 1633,1641 ****
  EXTERN int  alloc_fail_repeat INIT(= 0);
  
  /* flags set by test_override() */
! EXTERN int  disable_char_avail_for_testing INIT(= 0);
! EXTERN int  disable_redraw_for_testing INIT(= 0);
! EXTERN int  nfa_fail_for_testing INIT(= 0);
  
  EXTERN int  in_free_unref_items INIT(= FALSE);
  #endif
--- 1633,1642 ----
  EXTERN int  alloc_fail_repeat INIT(= 0);
  
  /* flags set by test_override() */
! EXTERN int  disable_char_avail_for_testing INIT(= FALSE);
! EXTERN int  disable_redraw_for_testing INIT(= FALSE);
! EXTERN int  ignore_redraw_flag_for_testing INIT(= FALSE);
! EXTERN int  nfa_fail_for_testing INIT(= FALSE);
  
  EXTERN int  in_free_unref_items INIT(= FALSE);
  #endif
*** ../vim-8.1.0348/runtime/doc/eval.txt        2018-09-02 15:18:38.906627880 
+0200
--- runtime/doc/eval.txt        2018-09-06 12:34:54.793088505 +0200
***************
*** 8728,8733 ****
--- 8737,8743 ----
  
                name         effect when {val} is non-zero ~
                redraw       disable the redrawing() function
+               redraw_flag  ignore the RedrawingDisabled flag
                char_avail   disable the char_avail() function
                starting     reset the "starting" variable, see below
                nfa_fail     makes the NFA regexp engine fail to force a
*** ../vim-8.1.0348/src/version.c       2018-09-05 22:25:45.999112143 +0200
--- src/version.c       2018-09-06 12:36:05.184408056 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     349,
  /**/

-- 
Anyone who is capable of getting themselves made President should on no
account be allowed to do the job.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// 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