summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSteffen Kieß <kiess@ki4.de>2020-08-24 00:53:00 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-10-02 22:26:43 +0000
commit763c08d809759343ca3558e84ae1a28f5d63b7df (patch)
tree77f1fe714af96c2ade8eef528717bc103dd08d55 /src/gui
parentfac6b14fc713a16854ce21c5caaa2726af492e05 (diff)
Ignore mouse events where globalPos contains NaN
A NaN value in globalPos can cause an endless recursion in QGuiApplicationPrivate::processMouseEvent() when e->enhancedMouseEvent() is true and this is not a move event. When an event contains a NaN in globalPos, print a warning and ignore the event. Fixes: QTBUG-86207 Change-Id: I8789e465921789569715e52c98193f91945ea982 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 63bbbdc4b8dba7be5690065dc6a4ffa5a85b1b32) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qguiapplication.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index ef09060581..72e1b16e55 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2131,6 +2131,11 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
bool mouseMove = false;
bool mousePress = false;
+ if (qIsNaN(e->globalPos.x()) || qIsNaN(e->globalPos.y())) {
+ qWarning("QGuiApplicationPrivate::processMouseEvent: Got NaN in mouse position");
+ return;
+ }
+
if (e->enhancedMouseEvent()) {
type = e->buttonType;
button = e->button;