From 85ceabccb43fff74adf62b0c056dabed176098a6 Mon Sep 17 00:00:00 2001 From: rschaub Date: Wed, 22 Oct 2025 15:04:04 +0200 Subject: [PATCH] qwindowspointerhandler: remove TouchPoint, if GetPointerType fails When attempting to translate a PointerEvent into a Qt event, the WinAPI is used to determine the pointer type (mouse, touchscreen, etc.). If this fails, previously cached touch points remained in an internal list and caused an additional TouchPoint to be generated with every subsequent touch event. Now, an attempt is made to remove the TouchPoint from the list if its ID can no longer be used. --- .../src/plugins/platforms/windows/qwindowspointerhandler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp index 4d30ec000f..51164c3165 100644 --- a/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/qtbase/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -50,6 +50,9 @@ bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, Q if (!GetPointerType(pointerId, &m_pointerType)) { qWarning() << "GetPointerType() failed:" << qt_error_string(); + int id = m_touchInputIDToTouchPointID.value(pointerId, -1); + if (id != -1) + m_lastTouchPoints.remove(id); return false; } -- 2.24.0.windows.2