0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.0259: crash with mouse click when not initialized

Problem:    Crash with mouse click when not initialized.
Solution:   Check TabPageIdxs[] is not NULL.
This commit is contained in:
Bram Moolenaar
2022-08-24 19:27:45 +01:00
parent fd999452ad
commit 80525751c5
3 changed files with 81 additions and 62 deletions

View File

@@ -471,6 +471,8 @@ do_mouse(
start_visual.lnum = 0;
if (TabPageIdxs != NULL) // only when initialized
{
// Check for clicking in the tab page line.
if (mouse_row == 0 && firstwin->w_winrow > 0)
{
@@ -540,6 +542,7 @@ do_mouse(
tabpage_move(c1 <= 0 ? 9999 : c1 - 1);
return FALSE;
}
}
// When 'mousemodel' is "popup" or "popup_setpos", translate mouse events:
// right button up -> pop-up menu

View File

@@ -147,4 +147,18 @@ func Test_tabline_20_format_items_no_overrun()
set showtabline& tabline&
endfunc
func Test_mouse_click_in_tab()
" This used to crash because TabPageIdxs[] was not initialized
let lines =<< trim END
tabnew
set mouse=a
exe "norm \<LeftMouse>"
END
call writefile(lines, 'Xclickscript')
call RunVim([], [], "-e -s -S Xclickscript -c qa")
call delete('Xclickscript')
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -731,6 +731,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
259,
/**/
258,
/**/