]> granicus.if.org Git - vim/commitdiff
patch 8.0.0705: crash when there is an error in a timer callback v8.0.0705
authorBram Moolenaar <Bram@vim.org>
Mon, 10 Jul 2017 20:12:10 +0000 (22:12 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 10 Jul 2017 20:12:10 +0000 (22:12 +0200)
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.

src/ex_cmds2.c
src/ex_eval.c
src/version.c

index 76e62f7a0be5ea6734b46bd8c74a0116b8054913..5f195923400179049610d6561e6046066bf6d340 100644 (file)
@@ -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;
index 17e0fdb528359bbd0a6f9db85dfe3ebd20c15f3a..f209c5f9558baf14d70a515af7a2ffcf6395c713 100644 (file)
@@ -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;
index 8129a7eb84240c9de2cf1335bd3fb326e40a4ae6..93d26ef77cadc969583595ce5290157c9524b4ee 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    705,
 /**/
     704,
 /**/