diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-15 08:19:54 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-15 08:19:54 (GMT) |
commit | ab743885e66a970a3425d97c6547ce995de3f64f (patch) | |
tree | 9baf720fbb9c1d2ce27ee8c12559ce51521e62fe /src | |
parent | cde72ad73cf2ee31e701e84763c152685493b7c7 (diff) | |
parent | 54ce087390724b5e03f95b93a5661d0a60765daa (diff) | |
download | Qt-ab743885e66a970a3425d97c6547ce995de3f64f.zip Qt-ab743885e66a970a3425d97c6547ce995de3f64f.tar.gz Qt-ab743885e66a970a3425d97c6547ce995de3f64f.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging:
Crash fix, when the Object will be deleted during handling a QGestureEvent.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qgesturemanager.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qgesturemanager_p.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 5e9a0cb..9519447 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -175,9 +175,9 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ 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; @@ -385,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; } @@ -447,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! diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index 0d84b67..a5a3482 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -130,6 +130,7 @@ private: QHash<QGestureRecognizer *, QSet<QGesture *> > m_obsoleteGestures; QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers; + QSet<QGesture *> m_gesturesToDelete; void cleanupGesturesForRemovedRecognizer(QGesture *gesture); QGesture *getState(QObject *widget, QGestureRecognizer *recognizer, |