0
0
mirror of https://github.com/vim/vim.git synced 2025-10-29 09:37:35 -04:00

patch 9.1.1564: crash when opening popup to closing buffer

Problem:  Can open a popup window to a closing buffer, leading to the
          buffer remaining open in the window after it's soon unloaded,
          causing crashes.
Solution: Check b_locked_split when opening a popup window to an
          existing buffer (Sean Dewar).

closes: #17790

Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Sean Dewar
2025-07-18 20:09:47 +02:00
committed by Christian Brabandt
parent be863b2633
commit 2e58b7684f
5 changed files with 3095 additions and 1 deletions

View File

@@ -2092,6 +2092,14 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
else if (popup_is_notification(type))
tabnr = -1; // show on all tabs
if (buf != NULL && buf->b_locked_split)
{
// disallow opening a popup to a closing buffer, which like splitting,
// can result in more windows displaying it
emsg(_(e_cannot_open_a_popup_window_to_a_closing_buffer));
return NULL;
}
// Create the window and buffer.
wp = win_alloc_popup_win();
if (wp == NULL)