commit 5feb8cdbb4d1ac01288058112702279c476f5aea
parent 64150517967fbe7fb111320c3dc1d16528aa547b
Author: Sean Dewar <seandewar@users.noreply.github.com>
Date: Sat, 9 Oct 2021 02:17:45 +0100
vim-patch:8.2.3478: still crash with error in :catch and also in :finally
Problem: Still crash with error in :catch and also in :finally.
Solution: Only call finish_exception() once. (closes vim/vim#8954)
https://github.com/vim/vim/commit/f67d3fb7363ebc9454f9bb582de3978609a4fd6b
Exclude CSF_FUNC_DEF change (Vim9script).
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
@@ -1934,8 +1934,9 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
*/
if (!(cstack->cs_flags[idx] & CSF_FINALLY)) {
if ((cstack->cs_flags[idx] & CSF_ACTIVE)
- && (cstack->cs_flags[idx] & CSF_CAUGHT)) {
+ && (cstack->cs_flags[idx] & CSF_CAUGHT) && !(cstack->cs_flags[idx] & CSF_FINISHED)) {
finish_exception((except_T *)cstack->cs_exception[idx]);
+ cstack->cs_flags[idx] |= CSF_FINISHED;
}
// Stop at this try conditional - except the try block never
// got active (because of an inactive surrounding conditional
diff --git a/src/nvim/ex_eval.h b/src/nvim/ex_eval.h
@@ -16,7 +16,8 @@
#define CSF_FINALLY 0x0200 // ":finally" has been passed
#define CSF_THROWN 0x0800 // exception thrown to this try conditional
#define CSF_CAUGHT 0x1000 // exception caught by this try conditional
-#define CSF_SILENT 0x2000 // "emsg_silent" reset by ":try"
+#define CSF_FINISHED 0x2000 // CSF_CAUGHT was handled by finish_exception()
+#define CSF_SILENT 0x4000 // "emsg_silent" reset by ":try"
// Note that CSF_ELSE is only used when CSF_TRY and CSF_WHILE are unset
// (an ":if"), and CSF_SILENT is only used when CSF_TRY is set.