vim-patch:9.0.1469: deferred functions not called from autocommands

Problem:    Deferred functions not called from autocommands.
Solution:   Also go through the funccal_stack. (closes vim/vim#12267)

960cf9119e
This commit is contained in:
zeertzjq
2023-04-19 07:59:35 +08:00
parent a11849abdf
commit a0c982671e
2 changed files with 37 additions and 2 deletions

View File

@@ -3270,8 +3270,14 @@ static void handle_defer_one(funccall_T *funccal)
/// Called when exiting: call all defer functions.
void invoke_all_defer(void)
{
for (funccall_T *funccal = current_funccal; funccal != NULL; funccal = funccal->fc_caller) {
handle_defer_one(funccal);
for (funccal_entry_T *fce = funccal_stack; fce != NULL; fce = fce->next) {
for (funccall_T *fc = fce->top_funccal; fc != NULL; fc = fc->fc_caller) {
handle_defer_one(fc);
}
}
for (funccall_T *fc = current_funccal; fc != NULL; fc = fc->fc_caller) {
handle_defer_one(fc);
}
}