mirror of https://github.com/qt/qtbase.git
macOS: Handle NaN mouse event positions
When performing gestures such as Exposé or Mission Control with the mouse button down, the position of the mouse release event is returned with NaN values. This causes QGuiApplicationPrivate::processMouseEvent to be called recursively and ultimately crash. Task-number: QTBUG-67194 Change-Id: If1536bc4dc2075c498cdd6c5afe57c86bdaac13b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
90ec3aba06
commit
992f673782
|
@ -487,8 +487,12 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
|
|||
NSPoint screenPoint;
|
||||
if (theEvent) {
|
||||
NSPoint windowPoint = [theEvent locationInWindow];
|
||||
NSRect screenRect = [[theEvent window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)];
|
||||
screenPoint = screenRect.origin;
|
||||
if (qIsNaN(windowPoint.x) || qIsNaN(windowPoint.y)) {
|
||||
screenPoint = [NSEvent mouseLocation];
|
||||
} else {
|
||||
NSRect screenRect = [[theEvent window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)];
|
||||
screenPoint = screenRect.origin;
|
||||
}
|
||||
} else {
|
||||
screenPoint = [NSEvent mouseLocation];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue