diff options
Diffstat (limited to 'src/gui/kernel/qgesturemanager.cpp')
-rw-r--r-- | src/gui/kernel/qgesturemanager.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 6dd8127..9519447 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -171,9 +171,13 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ foreach (QGesture *g, gestures) { m_deletedRecognizers.remove(g); m_gestureToRecognizer.remove(g); + m_maybeGestures.remove(g); + m_activeGestures.remove(g); + m_gestureOwners.remove(g); + m_gestureTargets.remove(g); + m_gesturesToDelete.insert(g); } - qDeleteAll(gestures); iter = m_objectGestures.erase(iter); } else { ++iter; @@ -381,6 +385,11 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *, recycle(gesture); m_gestureTargets.remove(gesture); } + + //Clean up the Gestures + qDeleteAll(m_gesturesToDelete); + m_gesturesToDelete.clear(); + return ret; } @@ -443,7 +452,8 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture) { QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture); - Q_ASSERT(recognizer); + if(!recognizer) //The Gesture is removed while in the even loop, so the recognizers for this gestures was removed + return; m_deletedRecognizers.remove(gesture); if (m_deletedRecognizers.keys(recognizer).isEmpty()) { // no more active gestures, cleanup! |