0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.2380: Vim9: occasional crash when using try/catch and a timer

Problem:    Vim9: occasional crash when using try/catch and a timer.
Solution:   Save and restore "need_rethrow" when invoking a timer callback.
            (closes #7708)
This commit is contained in:
Bram Moolenaar 2021-01-20 22:22:49 +01:00
parent 77a849c4b3
commit a0f7f73ebb
2 changed files with 5 additions and 0 deletions

View File

@ -478,6 +478,7 @@ check_due_timer(void)
int save_must_redraw = must_redraw; int save_must_redraw = must_redraw;
int save_trylevel = trylevel; int save_trylevel = trylevel;
int save_did_throw = did_throw; int save_did_throw = did_throw;
int save_need_rethrow = need_rethrow;
int save_ex_pressedreturn = get_pressedreturn(); int save_ex_pressedreturn = get_pressedreturn();
int save_may_garbage_collect = may_garbage_collect; int save_may_garbage_collect = may_garbage_collect;
except_T *save_current_exception = current_exception; except_T *save_current_exception = current_exception;
@ -493,6 +494,7 @@ check_due_timer(void)
must_redraw = 0; must_redraw = 0;
trylevel = 0; trylevel = 0;
did_throw = FALSE; did_throw = FALSE;
need_rethrow = FALSE;
current_exception = NULL; current_exception = NULL;
may_garbage_collect = FALSE; may_garbage_collect = FALSE;
save_vimvars(&vvsave); save_vimvars(&vvsave);
@ -513,6 +515,7 @@ check_due_timer(void)
called_emsg = save_called_emsg; called_emsg = save_called_emsg;
trylevel = save_trylevel; trylevel = save_trylevel;
did_throw = save_did_throw; did_throw = save_did_throw;
need_rethrow = save_need_rethrow;
current_exception = save_current_exception; current_exception = save_current_exception;
restore_vimvars(&vvsave); restore_vimvars(&vvsave);
if (must_redraw != 0) if (must_redraw != 0)

View File

@ -750,6 +750,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 */
/**/
2380,
/**/ /**/
2379, 2379,
/**/ /**/