Patch 8.0.1450
Problem:    Endless loop when gui_mch_stop_blink() is called while blink_state
            is BLINK_OFF. (zdohnal)
Solution:   Avoid calling gui_update_cursor() recursively.
Files:      src/gui.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro,
            src/gui_mac.c, src/proto/gui_mac.pro, src/gui_photon.c,
            src/proto/gui_photon.pro, src/gui_w32.c, src/proto/gui_w32.pro,
            src/gui_x11.c, src/proto/gui_x11.pro


*** ../vim-8.0.1449/src/gui.c   2018-01-31 20:51:40.301835954 +0100
--- src/gui.c   2018-01-31 21:02:15.659779202 +0100
***************
*** 1124,1130 ****
                             shape->blinkoff);
        if (shape->blinkwait == 0 || shape->blinkon == 0
                                                       || shape->blinkoff == 0)
!           gui_mch_stop_blink();
  #ifdef FEAT_TERMINAL
        if (shape_bg != INVALCOLOR)
        {
--- 1124,1130 ----
                             shape->blinkoff);
        if (shape->blinkwait == 0 || shape->blinkon == 0
                                                       || shape->blinkoff == 0)
!           gui_mch_stop_blink(FALSE);
  #ifdef FEAT_TERMINAL
        if (shape_bg != INVALCOLOR)
        {
***************
*** 2982,2988 ****
         * for showmatch() */
        gui_mch_start_blink();
        retval = gui_wait_for_chars_or_timer(wtime);
!       gui_mch_stop_blink();
        return retval;
      }
  
--- 2982,2988 ----
         * for showmatch() */
        gui_mch_start_blink();
        retval = gui_wait_for_chars_or_timer(wtime);
!       gui_mch_stop_blink(TRUE);
        return retval;
      }
  
***************
*** 3029,3035 ****
        retval = gui_wait_for_chars_or_timer(-1L);
      }
  
!     gui_mch_stop_blink();
      return retval;
  }
  
--- 3029,3035 ----
        retval = gui_wait_for_chars_or_timer(-1L);
      }
  
!     gui_mch_stop_blink(TRUE);
      return retval;
  }
  
*** ../vim-8.0.1449/src/gui_gtk_x11.c   2017-11-09 18:33:22.408374709 +0100
--- src/gui_gtk_x11.c   2018-01-31 21:04:26.406643871 +0100
***************
*** 893,906 ****
   * Stop the cursor blinking.  Show the cursor if it wasn't shown.
   */
      void
! gui_mch_stop_blink(void)
  {
      if (blink_timer)
      {
        timeout_remove(blink_timer);
        blink_timer = 0;
      }
!     if (blink_state == BLINK_OFF)
      {
        gui_update_cursor(TRUE, FALSE);
        gui_mch_flush();
--- 893,906 ----
   * Stop the cursor blinking.  Show the cursor if it wasn't shown.
   */
      void
! gui_mch_stop_blink(int may_call_gui_update_cursor)
  {
      if (blink_timer)
      {
        timeout_remove(blink_timer);
        blink_timer = 0;
      }
!     if (blink_state == BLINK_OFF && may_call_gui_update_cursor)
      {
        gui_update_cursor(TRUE, FALSE);
        gui_mch_flush();
***************
*** 975,981 ****
                   gpointer data UNUSED)
  {
      if (blink_state != BLINK_NONE)
!       gui_mch_stop_blink();
  
      return FALSE;
  }
--- 975,981 ----
                   gpointer data UNUSED)
  {
      if (blink_state != BLINK_NONE)
!       gui_mch_stop_blink(TRUE);
  
      return FALSE;
  }
***************
*** 1006,1012 ****
      gui_focus_change(FALSE);
  
      if (blink_state != BLINK_NONE)
!       gui_mch_stop_blink();
  
      return TRUE;
  }
--- 1006,1012 ----
      gui_focus_change(FALSE);
  
      if (blink_state != BLINK_NONE)
!       gui_mch_stop_blink(TRUE);
  
      return TRUE;
  }
***************
*** 1145,1151 ****
  
  #if GTK_CHECK_VERSION(3,0,0)
      is_key_pressed = TRUE;
!     gui_mch_stop_blink();
  #endif
  
      gui.event_time = event->time;
--- 1145,1151 ----
  
  #if GTK_CHECK_VERSION(3,0,0)
      is_key_pressed = TRUE;
!     gui_mch_stop_blink(TRUE);
  #endif
  
      gui.event_time = event->time;
***************
*** 6677,6683 ****
            if (gui.in_focus)
                gui_mch_start_blink();
            else
!               gui_mch_stop_blink();
            focus = gui.in_focus;
        }
  
--- 6677,6683 ----
            if (gui.in_focus)
                gui_mch_start_blink();
            else
!               gui_mch_stop_blink(TRUE);
            focus = gui.in_focus;
        }
  
*** ../vim-8.0.1449/src/proto/gui_gtk_x11.pro   2017-09-09 18:45:20.418225738 
+0200
--- src/proto/gui_gtk_x11.pro   2018-01-31 21:03:52.606935233 +0100
***************
*** 4,10 ****
  int gui_mch_is_blinking(void);
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long waittime, long on, long off);
! void gui_mch_stop_blink(void);
  void gui_mch_start_blink(void);
  int gui_mch_early_init_check(int give_message);
  int gui_mch_init_check(void);
--- 4,10 ----
  int gui_mch_is_blinking(void);
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long waittime, long on, long off);
! void gui_mch_stop_blink(int may_call_gui_update_cursor);
  void gui_mch_start_blink(void);
  int gui_mch_early_init_check(int give_message);
  int gui_mch_init_check(void);
***************
*** 25,31 ****
  void gui_mch_unmaximize(void);
  void gui_mch_newfont(void);
  void gui_mch_set_shellsize(int width, int height, int min_width, int 
min_height, int base_width, int base_height, int direction);
! void gui_gtk_get_screen_size_of_win(GtkWidget *win, int *width, int *height);
  void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h);
  void gui_mch_settitle(char_u *title, char_u *icon);
  void gui_mch_enable_menu(int showit);
--- 25,31 ----
  void gui_mch_unmaximize(void);
  void gui_mch_newfont(void);
  void gui_mch_set_shellsize(int width, int height, int min_width, int 
min_height, int base_width, int base_height, int direction);
! void gui_gtk_get_screen_size_of_win(GtkWidget *wid, int *width, int *height);
  void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h);
  void gui_mch_settitle(char_u *title, char_u *icon);
  void gui_mch_enable_menu(int showit);
*** ../vim-8.0.1449/src/gui_mac.c       2017-11-25 17:14:29.604189538 +0100
--- src/gui_mac.c       2018-01-31 21:04:57.058380802 +0100
***************
*** 5156,5164 ****
   * Stop the cursor blinking.  Show the cursor if it wasn't shown.
   */
      void
! gui_mch_stop_blink(void)
  {
!     gui_update_cursor(TRUE, FALSE);
      /* TODO: TODO: TODO: TODO: */
  /*    gui_w32_rm_blink_timer();
      if (blink_state == BLINK_OFF)
--- 5156,5165 ----
   * Stop the cursor blinking.  Show the cursor if it wasn't shown.
   */
      void
! gui_mch_stop_blink(int may_call_gui_update_cursor)
  {
!     if (may_call_gui_update_cursor)
!       gui_update_cursor(TRUE, FALSE);
      /* TODO: TODO: TODO: TODO: */
  /*    gui_w32_rm_blink_timer();
      if (blink_state == BLINK_OFF)
*** ../vim-8.0.1449/src/proto/gui_mac.pro       2017-07-23 16:45:05.673761155 
+0200
--- src/proto/gui_mac.pro       2018-01-31 21:05:31.058090206 +0100
***************
*** 17,23 ****
  int gui_mch_is_blinking(void);
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long wait, long on, long off);
! void gui_mch_stop_blink(void);
  void gui_mch_start_blink(void);
  void gui_mch_getmouse(int *x, int *y);
  void gui_mch_setmouse(int x, int y);
--- 17,23 ----
  int gui_mch_is_blinking(void);
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long wait, long on, long off);
! void gui_mch_stop_blink(int may_call_gui_update_cursor);
  void gui_mch_start_blink(void);
  void gui_mch_getmouse(int *x, int *y);
  void gui_mch_setmouse(int x, int y);
*** ../vim-8.0.1449/src/gui_photon.c    2017-07-23 16:45:05.673761155 +0200
--- src/gui_photon.c    2018-01-31 21:06:15.765709889 +0100
***************
*** 383,389 ****
            else
            {
                gui_focus_change(FALSE);
!               gui_mch_stop_blink();
            }
            break;
  
--- 383,389 ----
            else
            {
                gui_focus_change(FALSE);
!               gui_mch_stop_blink(TRUE);
            }
            break;
  
***************
*** 2273,2283 ****
  }
  
      void
! gui_mch_stop_blink(void)
  {
      PtSetResource(gui_ph_timer_cursor, Pt_ARG_TIMER_INITIAL, 0, 0);
  
!     if (blink_state == BLINK_OFF)
        gui_update_cursor(TRUE, FALSE);
  
      blink_state = BLINK_NONE;
--- 2273,2283 ----
  }
  
      void
! gui_mch_stop_blink(int may_call_gui_update_cursor)
  {
      PtSetResource(gui_ph_timer_cursor, Pt_ARG_TIMER_INITIAL, 0, 0);
  
!     if (blink_state == BLINK_OFF && may_call_gui_update_cursor)
        gui_update_cursor(TRUE, FALSE);
  
      blink_state = BLINK_NONE;
*** ../vim-8.0.1449/src/proto/gui_photon.pro    2017-07-23 16:45:05.673761155 
+0200
--- src/proto/gui_photon.pro    2018-01-31 21:06:28.401602749 +0100
***************
*** 44,50 ****
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long wait, long on, long off);
  void gui_mch_start_blink(void);
! void gui_mch_stop_blink(void);
  void gui_mch_beep(void);
  void gui_mch_flash(int msec);
  void gui_mch_flush(void);
--- 44,50 ----
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long wait, long on, long off);
  void gui_mch_start_blink(void);
! void gui_mch_stop_blink(int may_call_gui_update_cursor);
  void gui_mch_beep(void);
  void gui_mch_flash(int msec);
  void gui_mch_flush(void);
*** ../vim-8.0.1449/src/gui_w32.c       2018-01-31 20:51:40.305835913 +0100
--- src/gui_w32.c       2018-01-31 21:07:03.301307582 +0100
***************
*** 638,647 ****
   * Stop the cursor blinking.  Show the cursor if it wasn't shown.
   */
      void
! gui_mch_stop_blink(void)
  {
      gui_mswin_rm_blink_timer();
!     if (blink_state == BLINK_OFF)
      {
        gui_update_cursor(TRUE, FALSE);
        gui_mch_flush();
--- 638,647 ----
   * Stop the cursor blinking.  Show the cursor if it wasn't shown.
   */
      void
! gui_mch_stop_blink(int may_call_gui_update_cursor)
  {
      gui_mswin_rm_blink_timer();
!     if (blink_state == BLINK_OFF && may_call_gui_update_cursor)
      {
        gui_update_cursor(TRUE, FALSE);
        gui_mch_flush();
***************
*** 2111,2117 ****
            if (gui.in_focus)
                gui_mch_start_blink();
            else
!               gui_mch_stop_blink();
            focus = gui.in_focus;
        }
  
--- 2111,2117 ----
            if (gui.in_focus)
                gui_mch_start_blink();
            else
!               gui_mch_stop_blink(TRUE);
            focus = gui.in_focus;
        }
  
*** ../vim-8.0.1449/src/proto/gui_w32.pro       2017-11-26 14:29:24.847931598 
+0100
--- src/proto/gui_w32.pro       2018-01-31 21:07:08.057267442 +0100
***************
*** 3,9 ****
  int gui_mch_is_blinking(void);
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long wait, long on, long off);
! void gui_mch_stop_blink(void);
  void gui_mch_start_blink(void);
  LRESULT WINAPI vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM 
lParam);
  void gui_mch_new_colors(void);
--- 3,9 ----
  int gui_mch_is_blinking(void);
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long wait, long on, long off);
! void gui_mch_stop_blink(int may_call_gui_update_cursor);
  void gui_mch_start_blink(void);
  LRESULT WINAPI vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM 
lParam);
  void gui_mch_new_colors(void);
*** ../vim-8.0.1449/src/gui_x11.c       2017-11-18 22:13:04.745908763 +0100
--- src/gui_x11.c       2018-01-31 21:07:56.388860580 +0100
***************
*** 2746,2752 ****
            if (gui.in_focus)
                gui_mch_start_blink();
            else
!               gui_mch_stop_blink();
            focus = gui.in_focus;
        }
  
--- 2746,2752 ----
            if (gui.in_focus)
                gui_mch_start_blink();
            else
!               gui_mch_stop_blink(TRUE);
            focus = gui.in_focus;
        }
  
***************
*** 3105,3118 ****
   * Stop the cursor blinking.  Show the cursor if it wasn't shown.
   */
      void
! gui_mch_stop_blink(void)
  {
      if (blink_timer != (XtIntervalId)0)
      {
        XtRemoveTimeOut(blink_timer);
        blink_timer = (XtIntervalId)0;
      }
!     if (blink_state == BLINK_OFF)
        gui_update_cursor(TRUE, FALSE);
      blink_state = BLINK_NONE;
  }
--- 3105,3118 ----
   * Stop the cursor blinking.  Show the cursor if it wasn't shown.
   */
      void
! gui_mch_stop_blink(int may_call_gui_update_cursor)
  {
      if (blink_timer != (XtIntervalId)0)
      {
        XtRemoveTimeOut(blink_timer);
        blink_timer = (XtIntervalId)0;
      }
!     if (blink_state == BLINK_OFF && may_call_gui_update_cursor)
        gui_update_cursor(TRUE, FALSE);
      blink_state = BLINK_NONE;
  }
*** ../vim-8.0.1449/src/proto/gui_x11.pro       2017-07-23 16:45:05.669761183 
+0200
--- src/proto/gui_x11.pro       2018-01-31 21:08:00.552825615 +0100
***************
*** 57,63 ****
  int gui_mch_is_blinking(void);
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long waittime, long on, long off);
! void gui_mch_stop_blink(void);
  void gui_mch_start_blink(void);
  guicolor_T gui_mch_get_rgb(guicolor_T pixel);
  void gui_x11_callbacks(Widget textArea, Widget vimForm);
--- 57,63 ----
  int gui_mch_is_blinking(void);
  int gui_mch_is_blink_off(void);
  void gui_mch_set_blinking(long waittime, long on, long off);
! void gui_mch_stop_blink(int may_call_gui_update_cursor);
  void gui_mch_start_blink(void);
  guicolor_T gui_mch_get_rgb(guicolor_T pixel);
  void gui_x11_callbacks(Widget textArea, Widget vimForm);
*** ../vim-8.0.1449/src/version.c       2018-01-31 20:51:40.313835826 +0100
--- src/version.c       2018-01-31 21:08:35.376533705 +0100
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1450,
  /**/

-- 
FIRST HEAD:  Oh! quick! get the sword out I want to cut his head off.
THIRD HEAD:  Oh, cut your own head off.
SECOND HEAD: Yes - do us all a favour.
                 "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