]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0302: crash when using :suspend and "fg" v8.1.0302
authorBram Moolenaar <Bram@vim.org>
Mon, 20 Aug 2018 19:58:57 +0000 (21:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 20 Aug 2018 19:58:57 +0000 (21:58 +0200)
Problem:    Crash when using :suspend and "fg".
Solution:   Undo patch 8.1.244.

src/os_unix.c
src/proto/term.pro
src/term.c
src/version.c

index b044df27f7044751c2243276311bc7766e3335d6..39ace2e295177ab01cb98965ea1cfd906a8e7ef5 100644 (file)
@@ -1228,24 +1228,7 @@ deathtrap SIGDEFARG(sigarg)
     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)
+#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,7 +1240,7 @@ static int in_mch_suspend = FALSE;
  * volatile because it is used in signal handler sigcont_handler().
  */
 static volatile int sigcont_received;
-# endif
+static RETSIGTYPE sigcont_handler SIGPROTOARG;
 
 /*
  * signal handler for SIGCONT
@@ -1265,38 +1248,7 @@ static volatile int sigcont_received;
     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();
-    }
-
+    sigcont_received = TRUE;
     SIGRETURN;
 }
 #endif
@@ -1379,8 +1331,6 @@ mch_suspend(void)
 {
     /* 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 */
@@ -1412,9 +1362,16 @@ mch_suspend(void)
            mch_delay(wait_time, FALSE);
     }
 # endif
-    in_mch_suspend = FALSE;
 
-    after_sigcont();
+# 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,7 +1411,7 @@ set_signals(void)
 #ifdef SIGTSTP
     signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
 #endif
-#if defined(SIGCONT)
+#if defined(_REENTRANT) && defined(SIGCONT)
     signal(SIGCONT, sigcont_handler);
 #endif
 
index 1b8ab5f0dd833f9a6852761224491cbacd1c0841..c68d7ab033e819e49526864fae5e8053bfa729bb 100644 (file)
@@ -52,7 +52,6 @@ void setmouse(void);
 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);
index 66f03ee1082a2fdd0c986a8ab90208f45cf7cdbd..97ddf8bc4a1295cf875411b7c3ad30e77c8cb10c 100644 (file)
@@ -3833,16 +3833,6 @@ scroll_start(void)
 
 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.
  */
@@ -3850,7 +3840,10 @@ cursor_on_force(void)
 cursor_on(void)
 {
     if (cursor_is_off)
-       cursor_on_force();
+    {
+       out_str(T_VE);
+       cursor_is_off = FALSE;
+    }
 }
 
 /*
index 4cb2f341954d8ab3a9066e99724e8ebebda0e87a..42a81ccfa8e1091f4797738f657250cef0af9163 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    302,
 /**/
     301,
 /**/