diff options
author | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-04-09 14:23:49 +0200 |
---|---|---|
committer | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-04-10 06:56:01 +0000 |
commit | 67784558e359d601343c51898359e5e9b97dad20 (patch) | |
tree | bae938063b74533353056e0f100da93c5361c273 | |
parent | 886776c496d8902b56d47f7e5253d2e3a540b1f5 (diff) | |
download | qtlocation-67784558e359d601343c51898359e5e9b97dad20.tar.gz |
QQuickGeoMapGestureArea: Fix crasher when m_mousePoint is null
Happens when the first input it receives is a touch one.
Task-number: QTBUG-67580
Change-Id: Ia9441c753da15f2fe907901450d182027e11c8aa
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
-rw-r--r-- | src/location/declarativemaps/qquickgeomapgesturearea.cpp | 2 | ||||
-rw-r--r-- | tests/auto/declarative_ui/tst_map_flick.qml | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/location/declarativemaps/qquickgeomapgesturearea.cpp b/src/location/declarativemaps/qquickgeomapgesturearea.cpp index ccbd39a1..c6f4b42f 100644 --- a/src/location/declarativemaps/qquickgeomapgesturearea.cpp +++ b/src/location/declarativemaps/qquickgeomapgesturearea.cpp @@ -1726,7 +1726,7 @@ void QQuickGeoMapGestureArea::panStateMachine() bool QQuickGeoMapGestureArea::canStartPan() { if (m_allPoints.count() == 0 || (m_acceptedGestures & PanGesture) == 0 - || m_mousePoint->state() == Qt::TouchPointReleased) // mouseReleaseEvent handling does not clear m_mousePoint, only ungrabMouse does -- QTBUG-66534 + || (m_mousePoint && m_mousePoint->state() == Qt::TouchPointReleased)) // mouseReleaseEvent handling does not clear m_mousePoint, only ungrabMouse does -- QTBUG-66534 return false; // Check if thresholds for normal panning are met. diff --git a/tests/auto/declarative_ui/tst_map_flick.qml b/tests/auto/declarative_ui/tst_map_flick.qml index ba10d12e..16598d29 100644 --- a/tests/auto/declarative_ui/tst_map_flick.qml +++ b/tests/auto/declarative_ui/tst_map_flick.qml @@ -348,5 +348,17 @@ Item { map.disableOnPanStartedWithNoGesture = true disable_onPanStarted() } + + /* + Regression test for QTBUG-67580 where touching the map + (as opposing to clicking it with a mouse) would cause a crash. + So this test is merely about surviving a tap. + */ + function test_touch() + { + touchEvent(map).press(0).commit(); + wait(25); + touchEvent(map).release(0).commit(); + } } } |