summaryrefslogtreecommitdiffstats
path: root/src/time.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-10-19 10:52:34 +0200
committerChristian Brabandt <cb@256bit.org>2023-10-19 10:52:34 +0200
commitc59c1e0d88651a71ece7366e418f1253abbe2a28 (patch)
tree98453e9da10f027b806d3c3cf2cd524df85241c5 /src/time.c
parentd7b616d0ad006db06140729313b6217677cc4e80 (diff)
patch 9.0.2050: Vim9: crash with deferred function call and exceptionv9.0.2050
Problem: Vim9: crash with deferred function call and exception Solution: Save and restore exception state Crash when a deferred function is called after an exception and another exception is thrown closes: #13376 closes: #13377 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/time.c')
-rw-r--r--src/time.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/time.c b/src/time.c
index 62b38b4bf9..8725a8852c 100644
--- a/src/time.c
+++ b/src/time.c
@@ -561,13 +561,12 @@ check_due_timer(void)
int prev_uncaught_emsg = uncaught_emsg;
int save_called_emsg = called_emsg;
int save_must_redraw = must_redraw;
- int save_trylevel = trylevel;
- int save_did_throw = did_throw;
- int save_need_rethrow = need_rethrow;
int save_ex_pressedreturn = get_pressedreturn();
int save_may_garbage_collect = may_garbage_collect;
- except_T *save_current_exception = current_exception;
- vimvars_save_T vvsave;
+ vimvars_save_T vvsave;
+ exception_state_T estate;
+
+ exception_state_save(&estate);
// Create a scope for running the timer callback, ignoring most of
// the current scope, such as being inside a try/catch.
@@ -576,11 +575,8 @@ check_due_timer(void)
called_emsg = 0;
did_emsg = FALSE;
must_redraw = 0;
- trylevel = 0;
- did_throw = FALSE;
- need_rethrow = FALSE;
- current_exception = NULL;
may_garbage_collect = FALSE;
+ exception_state_clear();
save_vimvars(&vvsave);
// Invoke the callback.
@@ -597,10 +593,7 @@ check_due_timer(void)
++timer->tr_emsg_count;
did_emsg = save_did_emsg;
called_emsg = save_called_emsg;
- trylevel = save_trylevel;
- did_throw = save_did_throw;
- need_rethrow = save_need_rethrow;
- current_exception = save_current_exception;
+ exception_state_restore(&estate);
restore_vimvars(&vvsave);
if (must_redraw != 0)
need_update_screen = TRUE;