summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-10-05 11:22:27 +0100
committerBram Moolenaar <Bram@vim.org>2021-10-05 11:22:27 +0100
commitf67d3fb7363ebc9454f9bb582de3978609a4fd6b (patch)
treefa58a3c641caea17cf12301143c6c75a42060c75 /src
parent6d197987745427801a2195836ef89e48537afbeb (diff)
patch 8.2.3478: still crash with error in :catch and also in :finallyv8.2.3478
Problem: Still crash with error in :catch and also in :finally. Solution: Only call finish_exception() once. (closes #8954)
Diffstat (limited to 'src')
-rw-r--r--src/ex_eval.c6
-rw-r--r--src/structs.h7
-rw-r--r--src/version.c2
3 files changed, 11 insertions, 4 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 503a3ae02a..ee6816a396 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -2401,8 +2401,12 @@ cleanup_conditionals(
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
// or when the ":try" appeared after an error or interrupt or
diff --git a/src/structs.h b/src/structs.h
index eae6cd9281..b5889b7761 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -943,11 +943,12 @@ typedef struct {
# define CSF_CATCH 0x0400 // ":catch" has been seen
# 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.
-//
-#define CSF_FUNC_DEF 0x4000 // a function was defined in this block
+
+# define CSF_FUNC_DEF 0x8000 // a function was defined in this block
/*
* What's pending for being reactivated at the ":endtry" of this try
diff --git a/src/version.c b/src/version.c
index e65eb8c572..fa64466568 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3478,
+/**/
3477,
/**/
3476,