comparison src/ex_eval.c @ 11645:50f2a4ad1cfa v8.0.0705

patch 8.0.0705: crash when there is an error in a timer callback commit https://github.com/vim/vim/commit/cae24be4a808d60313913cc6feea6c2bee2e2a42 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 10 22:12:10 2017 +0200 patch 8.0.0705: crash when there is an error in a timer callback 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.
author Christian Brabandt <cb@256bit.org>
date Mon, 10 Jul 2017 22:15:03 +0200
parents 147f45c283e1
children 27b9a84395b5
comparison
equal deleted inserted replaced
11644:da9c50ac8391 11645:50f2a4ad1cfa
638 * Discard the exception currently being thrown. 638 * Discard the exception currently being thrown.
639 */ 639 */
640 void 640 void
641 discard_current_exception(void) 641 discard_current_exception(void)
642 { 642 {
643 discard_exception(current_exception, FALSE); 643 if (current_exception != NULL)
644 current_exception = NULL; 644 {
645 discard_exception(current_exception, FALSE);
646 current_exception = NULL;
647 }
645 did_throw = FALSE; 648 did_throw = FALSE;
646 need_rethrow = FALSE; 649 need_rethrow = FALSE;
647 } 650 }
648 651
649 /* 652 /*
1976 * This is needed for the do_cmdline() call that is going to be made 1979 * This is needed for the do_cmdline() call that is going to be made
1977 * for autocommand execution. We need not save *msg_list because 1980 * for autocommand execution. We need not save *msg_list because
1978 * there is an extra instance for every call of do_cmdline(), anyway. 1981 * there is an extra instance for every call of do_cmdline(), anyway.
1979 */ 1982 */
1980 if (did_throw || need_rethrow) 1983 if (did_throw || need_rethrow)
1984 {
1981 csp->exception = current_exception; 1985 csp->exception = current_exception;
1986 current_exception = NULL;
1987 }
1982 else 1988 else
1983 { 1989 {
1984 csp->exception = NULL; 1990 csp->exception = NULL;
1985 if (did_emsg) 1991 if (did_emsg)
1986 { 1992 {