To: vim_dev@googlegroups.com Subject: Patch 8.0.0705 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0705 (after 8.0.0702) 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. Files: src/ex_eval.c, src/ex_cmds2.c *** ../vim-8.0.0704/src/ex_eval.c 2016-11-10 20:20:01.874602675 +0100 --- src/ex_eval.c 2017-07-10 21:50:04.231015133 +0200 *************** *** 640,647 **** void discard_current_exception(void) { ! discard_exception(current_exception, FALSE); ! current_exception = NULL; did_throw = FALSE; need_rethrow = FALSE; } --- 640,650 ---- void discard_current_exception(void) { ! if (current_exception != NULL) ! { ! discard_exception(current_exception, FALSE); ! current_exception = NULL; ! } did_throw = FALSE; need_rethrow = FALSE; } *************** *** 1978,1984 **** --- 1981,1990 ---- * 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; *** ../vim-8.0.0704/src/ex_cmds2.c 2017-07-08 22:37:02.019229190 +0200 --- src/ex_cmds2.c 2017-07-10 22:09:38.106178339 +0200 *************** *** 1235,1241 **** if (called_emsg) { ++timer->tr_emsg_count; ! if (!did_throw_save && current_exception != NULL) discard_current_exception(); } did_emsg = did_emsg_save; --- 1235,1241 ---- if (called_emsg) { ++timer->tr_emsg_count; ! if (!did_throw_save && did_throw && current_exception != NULL) discard_current_exception(); } did_emsg = did_emsg_save; *** ../vim-8.0.0704/src/version.c 2017-07-09 15:41:44.625938780 +0200 --- src/version.c 2017-07-10 22:02:44.101299686 +0200 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 705, /**/ -- "The sun oozed over the horizon, shoved aside darkness, crept along the greensward, and, with sickly fingers, pushed through the castle window, revealing the pillaged princess, hand at throat, crown asunder, gaping in frenzied horror at the sated, sodden amphibian lying beside her, disbelieving the magnitude of the frog's deception, screaming madly, "You lied!" - Winner of the Bulwer-Lytton contest (San Jose State University), wherein one writes only the first line of a bad novel /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///