]> granicus.if.org Git - vim/commitdiff
patch 8.2.5113: timer becomes invalid after fork/exec, :gui gives errors v8.2.5113
authorBram Moolenaar <Bram@vim.org>
Thu, 16 Jun 2022 17:47:20 +0000 (18:47 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 16 Jun 2022 17:47:20 +0000 (18:47 +0100)
Problem:    Timer becomes invalid after fork/exec, :gui gives errors. (Gabriel
            Dupras)
Solution:   Delete the timer befor forking. (closes #10584)

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

index 68c64d298e5a5c8b117cc3a7f2a98b600facd7b9..4408545db3b232a35f23d1245ed6a7f8d79f0b89 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -226,6 +226,11 @@ gui_do_fork(void)
     int                exit_status;
     pid_t      pid = -1;
 
+#if defined(FEAT_RELTIME) && defined(HAVE_TIMER_CREATE)
+    // a timer is not carried forward
+    delete_timer();
+#endif
+
     // Setup a pipe between the child and the parent, so that the parent
     // knows when the child has done the setsid() call and is allowed to
     // exit.
index 766deac9a8ec8aa388234bf3a6d459781288666b..6fd24508ddf5a380bac3ad43bc6db7120536a54f 100644 (file)
@@ -8247,7 +8247,7 @@ xsmp_close(void)
 #endif // USE_XSMP
 
 #if defined(FEAT_RELTIME) || defined(PROTO)
-# if defined(HAVE_TIMER_CREATE)
+# if defined(HAVE_TIMER_CREATE) || defined(PROTO)
 /*
  * Implement timeout with timer_create() and timer_settime().
  */
@@ -8331,6 +8331,19 @@ start_timeout(long msec)
     return &timeout_flag;
 }
 
+/*
+ * To be used before fork/exec: delete any created timer.
+ */
+    void
+delete_timer(void)
+{
+    if (timer_created)
+    {
+       timer_delete(timer_id);
+       timer_created = FALSE;
+    }
+}
+
 # else
 
 /*
index 91024b104c360e4dab1a981e54a8181289a5b2fd..268f3bfb659ce46b2de441271844c0780ec98598 100644 (file)
@@ -88,4 +88,5 @@ void xsmp_init(void);
 void xsmp_close(void);
 void stop_timeout(void);
 const int *start_timeout(long msec);
+void delete_timer(void);
 /* vim: set ft=c : */
index 66b03c3ab75a3cc7297a61e1944f3bc3b898d988..bfa9c5a263b25f4ca2d265da6683a7d60c86aa89 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5113,
 /**/
     5112,
 /**/