summaryrefslogtreecommitdiffstats
path: root/src/ex_eval.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-10-21 11:59:42 +0200
committerChristian Brabandt <cb@256bit.org>2023-10-21 11:59:42 +0200
commit0ab500dede4edd8d5aee7ddc63444537be527871 (patch)
tree96ebb872deec1d8ef086d9a133bd5167158c52fe /src/ex_eval.c
parenta36acb7ac444a789440dc30e0f04d5427069face (diff)
patch 9.0.2059: outstanding exceptions may be skippedv9.0.2059
Problem: outstanding exceptions may be skipped Solution: When restoring exception state, process remaining outstanding exceptions closes: #13386 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r--src/ex_eval.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index e319dee0f0..79e9d94359 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -757,6 +757,7 @@ exception_state_save(exception_state_T *estate)
estate->estate_did_throw = did_throw;
estate->estate_need_rethrow = need_rethrow;
estate->estate_trylevel = trylevel;
+ estate->estate_did_emsg = did_emsg;
}
/*
@@ -765,11 +766,14 @@ exception_state_save(exception_state_T *estate)
void
exception_state_restore(exception_state_T *estate)
{
- if (current_exception == NULL)
- current_exception = estate->estate_current_exception;
- did_throw |= estate->estate_did_throw;
- need_rethrow |= estate->estate_need_rethrow;
- trylevel |= estate->estate_trylevel;
+ // Handle any outstanding exceptions before restoring the state
+ if (did_throw)
+ handle_did_throw();
+ current_exception = estate->estate_current_exception;
+ did_throw = estate->estate_did_throw;
+ need_rethrow = estate->estate_need_rethrow;
+ trylevel = estate->estate_trylevel;
+ did_emsg = estate->estate_did_emsg;
}
/*
@@ -782,6 +786,7 @@ exception_state_clear(void)
did_throw = FALSE;
need_rethrow = FALSE;
trylevel = 0;
+ did_emsg = 0;
}
/*