Fix tab-closing crash by middle mouse button (unexpected mouse position)

The TabBar.h getTabIndexAt(int x, int y) could fail to find the tab-index (the underlying TCM_HITTEST WM returns -1, when there is no tab at the current mouse position).

Fix #14328, close #14329
This commit is contained in:
xomx 2023-11-07 00:03:32 +01:00 committed by Don Ho
parent 1fafd0dc0b
commit 5b61cc1680
1 changed files with 2 additions and 1 deletions

View File

@ -849,7 +849,8 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
int xPos = LOWORD(lParam);
int yPos = HIWORD(lParam);
int currentTabOn = getTabIndexAt(xPos, yPos);
notify(TCN_TABDELETE, currentTabOn);
if (currentTabOn != -1)
notify(TCN_TABDELETE, currentTabOn);
return TRUE;
}