aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-02-25 13:57:46 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2019-03-04 12:39:41 +0000
commit042f2b67739439c020451843d887d131d5f9cbdc (patch)
treee1ceb4900a708f1b710fadd364e20e6d9327b2b2 /src/quick/items
parent7df099a644339a487a5ad681d61efb1c7ecd81f6 (diff)
Don't crash if the synth-mouse touchpoint is absent from a touch event
Fixes: QTBUG-74008 Change-Id: Ib232b723e4a246db0312145ef475ce81cd5f1a5f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickwindow.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index fa5d64d7be..518970d1b7 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -2528,18 +2528,22 @@ bool QQuickWindowPrivate::deliverPressOrReleaseEvent(QQuickPointerEvent *event,
int pointCount = event->pointCount();
QVector<QQuickItem *> targetItems;
bool isTouchEvent = (event->asPointerTouchEvent() != nullptr);
- if (isTouchEvent && event->isPressEvent() && isDeliveringTouchAsMouse() &&
- pointerEventInstance(touchMouseDevice)->pointById(touchMouseId)->grabberPointerHandler()) {
- // When a second point is pressed, if the first point's existing
- // grabber was a pointer handler while a filtering parent is filtering
- // the same first point _as mouse_: we're starting over with delivery,
- // so we need to allow the second point to now be sent as a synth-mouse
- // instead of the first one, so that filtering parents (maybe even the
- // same one) can get a chance to see the second touchpoint as a
- // synth-mouse and perhaps grab it. Ideally we would always do this
- // when a new touchpoint is pressed, but this compromise fixes
- // QTBUG-70998 and avoids breaking tst_FlickableInterop::touchDragSliderAndFlickable
- cancelTouchMouseSynthesis();
+ if (isTouchEvent && event->isPressEvent() && isDeliveringTouchAsMouse()) {
+ if (const QQuickEventPoint *point = pointerEventInstance(touchMouseDevice)->pointById(touchMouseId)) {
+ // When a second point is pressed, if the first point's existing
+ // grabber was a pointer handler while a filtering parent is filtering
+ // the same first point _as mouse_: we're starting over with delivery,
+ // so we need to allow the second point to now be sent as a synth-mouse
+ // instead of the first one, so that filtering parents (maybe even the
+ // same one) can get a chance to see the second touchpoint as a
+ // synth-mouse and perhaps grab it. Ideally we would always do this
+ // when a new touchpoint is pressed, but this compromise fixes
+ // QTBUG-70998 and avoids breaking tst_FlickableInterop::touchDragSliderAndFlickable
+ if (point->grabberPointerHandler())
+ cancelTouchMouseSynthesis();
+ } else {
+ qCWarning(DBG_TOUCH_TARGET) << "during delivery of touch press, synth-mouse ID" << touchMouseId << "is missing from" << event;
+ }
}
for (int i = 0; i < pointCount; ++i) {
auto point = event->point(i);