diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-09-17 14:17:13 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-09-17 17:47:49 +0000 |
commit | 116b41eed67ca923ca205d2c7aa0776b0eaa1a4e (patch) | |
tree | a827e5dc245b5f1efec3349ab6b51694c1c41055 /src/imports | |
parent | a99b8ced41b2c634598ce70fe69036a0ed34e9ba (diff) | |
download | qtlocation-116b41eed67ca923ca205d2c7aa0776b0eaa1a4e.tar.gz |
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 <alexander.blasche@theqtcompany.com>
Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/location/qquickgeomapgesturearea.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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 |