From 47d3d5569e25d0e88259e1f0448d87325da0ab6a Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Wed, 16 Jun 2010 13:54:56 +0200 Subject: Make sure only started gestures can cause cancellations The design is that calling setGestureCancelPolicy on the gesture that is in starting state, and is accepted can cause other gestures to be cancelled. So change the logic to follow this, which means we won't try to execute the cancel strategy if the gesture was never accepted and avoid the crash detailed in the task. Reviewed-by: Denis Task-number: QTBUG-9771 --- src/gui/graphicsview/qgraphicsscene.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 6c5623e..ca3b56f 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -6277,7 +6277,8 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) { Q_ASSERT(original); QGraphicsItem *originalItem = gestureTargets.value(original); - Q_ASSERT(originalItem); + if (originalItem == 0) // we only act on accepted gestures, which implies it has a target. + return; // iterate over all active gestures and for each find the owner // if the owner is part of our sub-hierarchy, cancel it. -- cgit v0.12