To: vim_dev@googlegroups.com Subject: Patch 8.1.0302 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0302 Problem: Crash when using :suspend and "fg". Solution: Undo patch 8.1.244. Files: src/os_unix.c, src/term.c, src/proto/term.pro *** ../vim-8.1.0301/src/os_unix.c 2018-08-19 22:20:11.628993678 +0200 --- src/os_unix.c 2018-08-20 21:54:06.847128443 +0200 *************** *** 1228,1251 **** SIGRETURN; } ! static void ! after_sigcont(void) ! { ! # ifdef FEAT_TITLE ! // Don't change "oldtitle" in a signal handler, set a flag to obtain it ! // again later. ! oldtitle_outdated = TRUE; ! # endif ! settmode(TMODE_RAW); ! need_check_timestamps = TRUE; ! did_check_timestamps = FALSE; ! } ! ! #if defined(SIGCONT) ! static RETSIGTYPE sigcont_handler SIGPROTOARG; ! static int in_mch_suspend = FALSE; ! ! # if defined(_REENTRANT) && defined(SIGCONT) /* * On Solaris with multi-threading, suspending might not work immediately. * Catch the SIGCONT signal, which will be used as an indication whether the --- 1228,1234 ---- SIGRETURN; } ! #if defined(_REENTRANT) && defined(SIGCONT) /* * On Solaris with multi-threading, suspending might not work immediately. * Catch the SIGCONT signal, which will be used as an indication whether the *************** *** 1257,1263 **** * volatile because it is used in signal handler sigcont_handler(). */ static volatile int sigcont_received; ! # endif /* * signal handler for SIGCONT --- 1240,1246 ---- * volatile because it is used in signal handler sigcont_handler(). */ static volatile int sigcont_received; ! static RETSIGTYPE sigcont_handler SIGPROTOARG; /* * signal handler for SIGCONT *************** *** 1265,1302 **** static RETSIGTYPE sigcont_handler SIGDEFARG(sigarg) { ! if (in_mch_suspend) ! { ! # if defined(_REENTRANT) && defined(SIGCONT) ! sigcont_received = TRUE; ! # endif ! } ! else ! { ! // We didn't suspend ourselves, assume we were stopped by a SIGSTOP ! // signal (which can't be intercepted) and get a SIGCONT. Need to get ! // back to a sane mode and redraw. ! after_sigcont(); ! ! update_screen(CLEAR); ! if (State & CMDLINE) ! redrawcmdline(); ! else if (State == HITRETURN || State == SETWSIZE || State == ASKMORE ! || State == EXTERNCMD || State == CONFIRM || exmode_active) ! repeat_message(); ! else if (redrawing()) ! setcursor(); ! #if defined(FEAT_INS_EXPAND) ! if (pum_visible()) ! { ! redraw_later(NOT_VALID); ! ins_compl_show_pum(); ! } ! #endif ! cursor_on_force(); ! out_flush(); ! } ! SIGRETURN; } #endif --- 1248,1254 ---- static RETSIGTYPE sigcont_handler SIGDEFARG(sigarg) { ! sigcont_received = TRUE; SIGRETURN; } #endif *************** *** 1379,1386 **** { /* BeOS does have SIGTSTP, but it doesn't work. */ #if defined(SIGTSTP) && !defined(__BEOS__) - in_mch_suspend = TRUE; - out_flush(); /* needed to make cursor visible on some systems */ settmode(TMODE_COOK); out_flush(); /* needed to disable mouse on some systems */ --- 1331,1336 ---- *************** *** 1412,1420 **** mch_delay(wait_time, FALSE); } # endif - in_mch_suspend = FALSE; ! after_sigcont(); #else suspend_shell(); #endif --- 1362,1377 ---- mch_delay(wait_time, FALSE); } # endif ! # ifdef FEAT_TITLE ! /* ! * Set oldtitle to NULL, so the current title is obtained again. ! */ ! VIM_CLEAR(oldtitle); ! # endif ! settmode(TMODE_RAW); ! need_check_timestamps = TRUE; ! did_check_timestamps = FALSE; #else suspend_shell(); #endif *************** *** 1454,1460 **** #ifdef SIGTSTP signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); #endif ! #if defined(SIGCONT) signal(SIGCONT, sigcont_handler); #endif --- 1411,1417 ---- #ifdef SIGTSTP signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); #endif ! #if defined(_REENTRANT) && defined(SIGCONT) signal(SIGCONT, sigcont_handler); #endif *** ../vim-8.1.0301/src/term.c 2018-08-07 22:30:26.666240863 +0200 --- src/term.c 2018-08-20 21:47:17.833581580 +0200 *************** *** 3834,3856 **** static int cursor_is_off = FALSE; /* - * Enable the cursor without checking if it's already enabled. - */ - void - cursor_on_force(void) - { - out_str(T_VE); - cursor_is_off = FALSE; - } - - /* * Enable the cursor. */ void cursor_on(void) { if (cursor_is_off) ! cursor_on_force(); } /* --- 3834,3849 ---- static int cursor_is_off = FALSE; /* * Enable the cursor. */ void cursor_on(void) { if (cursor_is_off) ! { ! out_str(T_VE); ! cursor_is_off = FALSE; ! } } /* *** ../vim-8.1.0301/src/proto/term.pro 2018-08-07 22:30:26.666240863 +0200 --- src/proto/term.pro 2018-08-20 21:47:24.961538793 +0200 *************** *** 52,58 **** int mouse_has(int c); int mouse_model_popup(void); void scroll_start(void); - void cursor_on_force(void); void cursor_on(void); void cursor_off(void); void term_cursor_mode(int forced); --- 52,57 ---- *** ../vim-8.1.0301/src/version.c 2018-08-19 22:58:39.783568118 +0200 --- src/version.c 2018-08-20 21:49:38.956734730 +0200 *************** *** 796,797 **** --- 796,799 ---- { /* Add new patch number below this line */ + /**/ + 302, /**/ -- SOLDIER: What? A swallow carrying a coconut? ARTHUR: It could grip it by the husk ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///