0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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)
This commit is contained in:
Bram Moolenaar
2022-06-16 18:47:20 +01:00
parent a272624c76
commit c72e31dfcc
4 changed files with 22 additions and 1 deletions

View File

@@ -226,6 +226,11 @@ gui_do_fork(void)
int exit_status; int exit_status;
pid_t pid = -1; 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 // 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 // knows when the child has done the setsid() call and is allowed to
// exit. // exit.

View File

@@ -8247,7 +8247,7 @@ xsmp_close(void)
#endif // USE_XSMP #endif // USE_XSMP
#if defined(FEAT_RELTIME) || defined(PROTO) #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(). * Implement timeout with timer_create() and timer_settime().
*/ */
@@ -8331,6 +8331,19 @@ start_timeout(long msec)
return &timeout_flag; 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 # else
/* /*

View File

@@ -88,4 +88,5 @@ void xsmp_init(void);
void xsmp_close(void); void xsmp_close(void);
void stop_timeout(void); void stop_timeout(void);
const int *start_timeout(long msec); const int *start_timeout(long msec);
void delete_timer(void);
/* vim: set ft=c : */ /* vim: set ft=c : */

View File

@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
5113,
/**/ /**/
5112, 5112,
/**/ /**/