Mercurial > vim
changeset 29187:87ad2de4fe41 v8.2.5113
patch 8.2.5113: timer becomes invalid after fork/exec, :gui gives errors
Commit: https://github.com/vim/vim/commit/c72e31dfcc013ae840cd7f8899f2430b7f6812c9
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 16 18:47:20 2022 +0100
patch 8.2.5113: timer becomes invalid after fork/exec, :gui gives errors
Problem: Timer becomes invalid after fork/exec, :gui gives errors. (Gabriel
Dupras)
Solution: Delete the timer befor forking. (closes #10584)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 16 Jun 2022 20:00:03 +0200 |
parents | b41c197d886e |
children | f96e0bc4494b |
files | src/gui.c src/os_unix.c src/proto/os_unix.pro src/version.c |
diffstat | 4 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -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 /*