summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-07-10 22:12:10 +0200
committerBram Moolenaar <Bram@vim.org>2017-07-10 22:12:10 +0200
commitcae24be4a808d60313913cc6feea6c2bee2e2a42 (patch)
tree5759bd8d564c2160ac7ab204cc3da7cc9ed32ba9
parent163095f088a7c29710a16c75bb56229dd3b4116a (diff)
patch 8.0.0705: crash when there is an error in a timer callbackv8.0.0705
Problem: Crash when there is an error in a timer callback. (Aron Griffis, Ozaki Kiichi) Solution: Check did_throw before discarding an exception. NULLify current_exception when no longer valid.
-rw-r--r--src/ex_cmds2.c2
-rw-r--r--src/ex_eval.c10
-rw-r--r--src/version.c2
3 files changed, 11 insertions, 3 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 76e62f7a0b..5f19592340 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1235,7 +1235,7 @@ check_due_timer(void)
if (called_emsg)
{
++timer->tr_emsg_count;
- if (!did_throw_save && current_exception != NULL)
+ if (!did_throw_save && did_throw && current_exception != NULL)
discard_current_exception();
}
did_emsg = did_emsg_save;
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 17e0fdb528..f209c5f955 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -640,8 +640,11 @@ discard_exception(except_T *excp, int was_finished)
void
discard_current_exception(void)
{
- discard_exception(current_exception, FALSE);
- current_exception = NULL;
+ if (current_exception != NULL)
+ {
+ discard_exception(current_exception, FALSE);
+ current_exception = NULL;
+ }
did_throw = FALSE;
need_rethrow = FALSE;
}
@@ -1978,7 +1981,10 @@ enter_cleanup(cleanup_T *csp)
* there is an extra instance for every call of do_cmdline(), anyway.
*/
if (did_throw || need_rethrow)
+ {
csp->exception = current_exception;
+ current_exception = NULL;
+ }
else
{
csp->exception = NULL;
diff --git a/src/version.c b/src/version.c
index 8129a7eb84..93d26ef77c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 705,
+/**/
704,
/**/
703,