1
0
forked from aniani/vim

patch 8.1.0342: crash when a callback deletes a window that is being used

Problem:    Crash when a callback deletes a window that is being used.
Solution:   Do not unload a buffer that is being displayed while redrawing the
            screen. Also avoid invoking callbacks while redrawing.
            (closes #2107)
This commit is contained in:
Bram Moolenaar
2018-09-01 15:30:03 +02:00
parent 32bbd00949
commit 94f01956a5
3 changed files with 42 additions and 23 deletions

View File

@@ -6366,33 +6366,38 @@ parse_queued_messages(void)
{
win_T *old_curwin = curwin;
/* For Win32 mch_breakcheck() does not check for input, do it here. */
// 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;
// For Win32 mch_breakcheck() does not check for input, do it here.
# if defined(WIN32) && defined(FEAT_JOB_CHANNEL)
channel_handle_events(FALSE);
# endif
# ifdef FEAT_NETBEANS_INTG
/* Process the queued netbeans messages. */
// Process the queued netbeans messages.
netbeans_parse_messages();
# endif
# ifdef FEAT_JOB_CHANNEL
/* Write any buffer lines still to be written. */
// Write any buffer lines still to be written.
channel_write_any_lines();
/* Process the messages queued on channels. */
// Process the messages queued on channels.
channel_parse_messages();
# endif
# if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11)
/* Process the queued clientserver messages. */
// Process the queued clientserver messages.
server_parse_messages();
# endif
# ifdef FEAT_JOB_CHANNEL
/* Check if any jobs have ended. */
// Check if any jobs have ended.
job_check_ended();
# endif
/* If the current window changed we need to bail out of the waiting loop.
* E.g. when a job exit callback closes the terminal window. */
// If the current window changed we need to bail out of the waiting loop.
// E.g. when a job exit callback closes the terminal window.
if (curwin != old_curwin)
ins_char_typebuf(K_IGNORE);
}