From 116b41eed67ca923ca205d2c7aa0776b0eaa1a4e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 17 Sep 2015 14:17:13 +0200 Subject: Do not crash in new gesture areas when getting a wheel event Newly constructed gesture areas lacked a null check for m_map. Thus sending a wheel event results in a crash. This is visible with the mapviewer example when attempting to change the provider but failing due to not having the necessary keys specified. Change-Id: I5983de284f528d4a682b5b239e807e0748bcd740 Reviewed-by: Alex Blasche Reviewed-by: Michal Klocek --- src/imports/location/qquickgeomapgesturearea.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/imports/location/qquickgeomapgesturearea.cpp b/src/imports/location/qquickgeomapgesturearea.cpp index 9ab11b97..baa9e702 100644 --- a/src/imports/location/qquickgeomapgesturearea.cpp +++ b/src/imports/location/qquickgeomapgesturearea.cpp @@ -672,6 +672,9 @@ void QQuickGeoMapGestureArea::handleTouchEvent(QTouchEvent *event) void QQuickGeoMapGestureArea::handleWheelEvent(QWheelEvent *event) { + if (!m_map) + return; + QGeoCoordinate wheelGeoPos = m_map->itemPositionToCoordinate(QDoubleVector2D(event->posF()), false); QPointF preZoomPoint = m_map->coordinateToItemPosition(wheelGeoPos, false).toPointF(); @@ -744,7 +747,9 @@ bool QQuickGeoMapGestureArea::isActive() const // simplify the gestures by using a state-machine format (easy to move to a future state machine) void QQuickGeoMapGestureArea::update() { - if (!m_map) return; + if (!m_map) + return; + // First state machine is for the number of touch points //combine touch with mouse event -- cgit v1.2.1