To: vim_dev@googlegroups.com Subject: Patch 8.2.5113 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5113 Problem: Timer becomes invalid after fork/exec, :gui gives errors. (Gabriel Dupras) Solution: Delete the timer befor forking. (closes #10584) Files: src/os_unix.c, src/proto/os_unix.pro, src/gui.c *** ../vim-8.2.5112/src/os_unix.c 2022-06-08 10:48:12.468987646 +0100 --- src/os_unix.c 2022-06-16 18:44:48.169667693 +0100 *************** *** 8247,8253 **** #endif // USE_XSMP #if defined(FEAT_RELTIME) || defined(PROTO) ! # if defined(HAVE_TIMER_CREATE) /* * Implement timeout with timer_create() and timer_settime(). */ --- 8247,8253 ---- #endif // USE_XSMP #if defined(FEAT_RELTIME) || defined(PROTO) ! # if defined(HAVE_TIMER_CREATE) || defined(PROTO) /* * Implement timeout with timer_create() and timer_settime(). */ *************** *** 8331,8336 **** --- 8331,8349 ---- 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 /* *** ../vim-8.2.5112/src/proto/os_unix.pro 2022-06-05 16:55:50.698774344 +0100 --- src/proto/os_unix.pro 2022-06-16 18:41:18.134194118 +0100 *************** *** 88,91 **** --- 88,92 ---- void xsmp_close(void); void stop_timeout(void); const int *start_timeout(long msec); + void delete_timer(void); /* vim: set ft=c : */ *** ../vim-8.2.5112/src/gui.c 2022-06-13 21:42:40.945531339 +0100 --- src/gui.c 2022-06-16 18:45:30.461579572 +0100 *************** *** 226,231 **** --- 226,236 ---- 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. *** ../vim-8.2.5112/src/version.c 2022-06-16 16:36:39.826598379 +0100 --- src/version.c 2022-06-16 18:46:26.709469960 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5113, /**/ -- Mushrooms always grow in damp places and so they look like umbrellas. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///