Skip to content

Commit

Permalink
Fix tab-closing crash by middle mouse button (unexpected mouse position)
Browse files Browse the repository at this point in the history
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 notepad-plus-plus#14328, close notepad-plus-plus#14329
  • Loading branch information
xomx authored and donho committed Nov 7, 2023
1 parent 1fafd0d commit 5b61cc1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion PowerEditor/src/WinControls/TabBar/TabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5b61cc1

Please sign in to comment.