diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-09-20 14:22:53 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-09-27 10:49:50 +0000 |
commit | 765f3afccb34b16c249c609d788374320cfbd25d (patch) | |
tree | 916651da9d32962f16fe405565c35d7dad34c8ff /src | |
parent | c08423ac01be53a40226b30e62d2d50d1fca9fd5 (diff) |
Don't crash when delivering stationary touchpoint as mouse release
QQuickPointerTouchEvent::touchEventForItem() can return a nullptr
so we have to check for that wherever we use it. In this crash scenario
while doing some kind of touch gesture it gets delivered as a synth
mouse event to a custom item. When you release the last finger (or
release multiple fingers simultaneously), touchEventForItem() returns
nullptr because the fingers were no longer moving before the release,
and QQuickWindowPrivate::deliverTouchAsMouse() didn't check for that.
Task-number: QTBUG-56090
Change-Id: I7ada1f82711296722226fdc06d9c5add2422335b
Reviewed-by: Paolo Angelelli <paolo.angelelli@theqtcompany.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 0bf5941d55..5bc3b78f42 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -630,6 +630,8 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve // FIXME: make this work for mouse events too and get rid of the asTouchEvent in here. Q_ASSERT(pointerEvent->asPointerTouchEvent()); QTouchEvent *event = pointerEvent->asPointerTouchEvent()->touchEventForItem(item); + if (!event) + return false; // For each point, check if it is accepted, if not, try the next point. // Any of the fingers can become the mouse one. |