File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2155,7 +2155,8 @@ parse_queued_messages(void)
21552155
21562156 // Do not handle messages while redrawing, because it may cause buffers to
21572157 // change or be wiped while they are being redrawn.
2158- if (updating_screen )
2158+ // Also bail out when parsing messages was explicitly disabled.
2159+ if (updating_screen || dont_parse_messages )
21592160 return ;
21602161
21612162 // If memory allocation fails during startup we'll exit but curbuf or
Original file line number Diff line number Diff line change @@ -581,6 +581,12 @@ EXTERN int diff_need_scrollbind INIT(= FALSE);
581581// ('lines' and 'rows') must not be changed.
582582EXTERN int updating_screen INIT (= FALSE);
583583
584+ #ifdef MESSAGE_QUEUE
585+ // While closing windows or buffers messages should not be handled to avoid
586+ // using invalid windows or buffers.
587+ EXTERN int dont_parse_messages INIT (= FALSE);
588+ #endif
589+
584590#ifdef FEAT_MENU
585591// The root of the menu hierarchy.
586592EXTERN vimmenu_T * root_menu INIT (= NULL);
Original file line number Diff line number Diff line change @@ -750,6 +750,8 @@ static char *(features[]) =
750750
751751static int included_patches [] =
752752{ /* Add new patch number below this line */
753+ /**/
754+ 1948 ,
753755/**/
754756 1947 ,
755757/**/
Original file line number Diff line number Diff line change @@ -2569,7 +2569,12 @@ win_close(win_T *win, int free_buf)
25692569
25702570 // Now we are really going to close the window. Disallow any autocommand
25712571 // to split a window to avoid trouble.
2572+ // Also bail out of parse_queued_messages() to avoid it tries to update the
2573+ // screen.
25722574 ++ split_disallowed ;
2575+ #ifdef MESSAGE_QUEUE
2576+ ++ dont_parse_messages ;
2577+ #endif
25732578
25742579 // Free the memory used for the window and get the window that received
25752580 // the screen space.
@@ -2626,6 +2631,9 @@ win_close(win_T *win, int free_buf)
26262631 }
26272632
26282633 -- split_disallowed ;
2634+ #ifdef MESSAGE_QUEUE
2635+ -- dont_parse_messages ;
2636+ #endif
26292637
26302638 /*
26312639 * If last window has a status line now and we don't want one,
You can’t perform that action at this time.
0 commit comments