diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2021-11-03 17:09:46 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2021-11-03 23:56:01 +0100 |
commit | 122f7d7adcbc16389728855dcff9f3e19c4652bd (patch) | |
tree | 0e06b37a7324c527dcf4e34f1a1c76768d3af4b1 /src/plugins/platforms | |
parent | efc1cd5799f692cfbc76bdfe1099d75141558c9b (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.
Pick-to: 6.2 5.15
Fixes: QTBUG-97945
Change-Id: I874c776b265d3950cc2b6c1d8054363b3d0d1fde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview_mouse.mm | 8 |
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 559257c4df..e689feef52 100644 --- a/src/plugins/platforms/cocoa/qnsview_mouse.mm +++ b/src/plugins/platforms/cocoa/qnsview_mouse.mm @@ -714,11 +714,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 |