From 5b61cc1680e4d4dd015e1e12ea77840af132d7b0 Mon Sep 17 00:00:00 2001 From: xomx Date: Tue, 7 Nov 2023 00:03:32 +0100 Subject: [PATCH] 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 --- PowerEditor/src/WinControls/TabBar/TabBar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 8940a4ae55e..156f784787f 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -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; }