To: vim_dev@googlegroups.com Subject: Patch 8.2.1948 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1948 Problem: GUI: crash when handling message while closing a window. (Srinath Avadhanula) Solution: Don't handle message while closing a window. (closes #7250) Files: src/window.c, src/globals.h, src/getchar.c *** ../vim-8.2.1947/src/window.c 2020-10-25 17:55:06.173001826 +0100 --- src/window.c 2020-11-04 10:58:39.421347889 +0100 *************** *** 2569,2575 **** --- 2569,2580 ---- // Now we are really going to close the window. Disallow any autocommand // to split a window to avoid trouble. + // Also bail out of parse_queued_messages() to avoid it tries to update the + // screen. ++split_disallowed; + #ifdef MESSAGE_QUEUE + ++dont_parse_messages; + #endif // Free the memory used for the window and get the window that received // the screen space. *************** *** 2626,2631 **** --- 2631,2639 ---- } --split_disallowed; + #ifdef MESSAGE_QUEUE + --dont_parse_messages; + #endif /* * If last window has a status line now and we don't want one, *** ../vim-8.2.1947/src/globals.h 2020-10-30 18:32:57.430698692 +0100 --- src/globals.h 2020-11-04 10:58:42.037340330 +0100 *************** *** 581,586 **** --- 581,592 ---- // ('lines' and 'rows') must not be changed. EXTERN int updating_screen INIT(= FALSE); + #ifdef MESSAGE_QUEUE + // While closing windows or buffers messages should not be handled to avoid + // using invalid windows or buffers. + EXTERN int dont_parse_messages INIT(= FALSE); + #endif + #ifdef FEAT_MENU // The root of the menu hierarchy. EXTERN vimmenu_T *root_menu INIT(= NULL); *** ../vim-8.2.1947/src/getchar.c 2020-09-28 22:29:25.421766301 +0200 --- src/getchar.c 2020-11-04 10:52:19.430444990 +0100 *************** *** 2155,2161 **** // Do not handle messages while redrawing, because it may cause buffers to // change or be wiped while they are being redrawn. ! if (updating_screen) return; // If memory allocation fails during startup we'll exit but curbuf or --- 2155,2162 ---- // Do not handle messages while redrawing, because it may cause buffers to // change or be wiped while they are being redrawn. ! // Also bail out when parsing messages was explicitly disabled. ! if (updating_screen || dont_parse_messages) return; // If memory allocation fails during startup we'll exit but curbuf or *** ../vim-8.2.1947/src/version.c 2020-11-03 20:05:36.178750002 +0100 --- src/version.c 2020-11-04 10:43:40.003940502 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1948, /**/ -- I'm in shape. Round IS a shape. /// 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 ///