summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2021-11-03 17:09:46 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-03 23:53:06 +0000
commit2ddf97578c2c6dd45ccbecf3b4afcd345eca04fb (patch)
treee883b3acf2f8a705f9535216490a2225256745e6 /src
parent1683ab80d6314ec26524fac568fd6bff572c3636 (diff)
qnsview_mouse, scrollWheel: do not assume zero deltas on Ending phase
It's somewhat difficult to reproduce, but having a mac with a trackpad and a huge scrollview (meaning I have to scroll fast and a lot), I am able from time to time to trigger an assert on the line: Q_ASSERT(pixelDelta.isNull() && angleDelta.isNull()) In all such cases, I can see that deltas are not zero, but equal to the ones that the next event (momentumPhase == Begin) has. The code is based on Tor Arne's patch. Fixes: QTBUG-97945 Change-Id: I874c776b265d3950cc2b6c1d8054363b3d0d1fde Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 122f7d7adcbc16389728855dcff9f3e19c4652bd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qnsview_mouse.mm8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview_mouse.mm b/src/plugins/platforms/cocoa/qnsview_mouse.mm
index 72b1050329..07edfab89c 100644
--- a/src/plugins/platforms/cocoa/qnsview_mouse.mm
+++ b/src/plugins/platforms/cocoa/qnsview_mouse.mm
@@ -718,11 +718,11 @@ static const QPointingDevice *pointingDeviceFor(qint64 deviceID)
// had time to emit a momentum phase event.
if ([NSApp nextEventMatchingMask:NSEventMaskScrollWheel untilDate:[NSDate distantPast]
inMode:@"QtMomementumEventSearchMode" dequeue:NO].momentumPhase == NSEventPhaseBegan) {
- Q_ASSERT(pixelDelta.isNull() && angleDelta.isNull());
- return; // Ignore this event, as it has a delta of 0,0
+ return; // Ignore, even if it has delta
+ } else {
+ phase = Qt::ScrollEnd;
+ m_scrolling = false;
}
- phase = Qt::ScrollEnd;
- m_scrolling = false;
} else if (theEvent.momentumPhase == NSEventPhaseBegan) {
Q_ASSERT(!pixelDelta.isNull() && !angleDelta.isNull());
phase = Qt::ScrollUpdate; // Send as update, it has a delta