diff src/userfunc.c @ 32278:f59ad8692734 v9.0.1470

patch 9.0.1470: deferred functions invoked in unexpected order Commit: https://github.com/vim/vim/commit/1be4b81bfb3d7edf0e2ae41711d429e8fa5e0555 Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Apr 19 14:21:24 2023 +0100 patch 9.0.1470: deferred functions invoked in unexpected order Problem: Deferred functions invoked in unexpected order when using :qa and autocommands. Solution: Call deferred functions for the current funccal before using the stack. (closes #12278)
author Bram Moolenaar <Bram@vim.org>
date Wed, 19 Apr 2023 15:30:04 +0200
parents 774c94489feb
children edea3992cb01
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -6144,12 +6144,12 @@ invoke_funccall_defer(funccall_T *fc)
     void
 invoke_all_defer(void)
 {
+    for (funccall_T *fc = current_funccal; fc != NULL; fc = fc->fc_caller)
+	invoke_funccall_defer(fc);
+
     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)
 	    invoke_funccall_defer(fc);
-
-    for (funccall_T *fc = current_funccal; fc != NULL; fc = fc->fc_caller)
-	invoke_funccall_defer(fc);
 }
 
 /*