vim-patch:9.0.2050: Vim9: crash with deferred function call and exception (#25715)

Problem:  Vim9: crash with deferred function call and exception
Solution: Save and restore exception state

Crash when a deferred function is called after an exception and another
exception is thrown

closes: vim/vim#13376
closes: vim/vim#13377

c59c1e0d88

The change in check_due_timer() is N/A as Nvim calls timer callbacks on
the main loop.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2023-10-19 18:34:48 +08:00
committed by GitHub
parent ae7020c667
commit a096165977
4 changed files with 62 additions and 18 deletions

View File

@@ -118,4 +118,14 @@ struct cleanup_stuff {
except_T *exception; ///< exception value
};
/// Exception state that is saved and restored when calling timer callback
/// functions and deferred functions.
typedef struct exception_state_S exception_state_T;
struct exception_state_S {
except_T *estate_current_exception;
bool estate_did_throw;
bool estate_need_rethrow;
int estate_trylevel;
};
#endif // NVIM_EX_EVAL_DEFS_H