summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qgesturemanager.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-05-05 09:58:33 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-05-05 13:28:25 (GMT)
commitd43037d3cc7f273a7d23ac1162a7498a4230c359 (patch)
tree12577bc6c7528416c2a30ac70991ad47739eecfc /src/gui/kernel/qgesturemanager.cpp
parent93415af11aeb879e68c46b9c4a470bbb898a4c59 (diff)
downloadQt-d43037d3cc7f273a7d23ac1162a7498a4230c359.zip
Qt-d43037d3cc7f273a7d23ac1162a7498a4230c359.tar.gz
Qt-d43037d3cc7f273a7d23ac1162a7498a4230c359.tar.bz2
Fixes a crash when unregistering a recognizer.
Another fix for the same problem - we also need to be careful - when ungrabbing a gesture for the recognizer that has already been destroyed and cleaning up the QGesture object for it we need to make sure we know it is removed from the obsolete gestures list so that we won't delete it again in the QGestureManager detructor. Task-number: QTBUG-9801 Reviewed-by: Thomas Zander
Diffstat (limited to 'src/gui/kernel/qgesturemanager.cpp')
-rw-r--r--src/gui/kernel/qgesturemanager.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index a806629..6ce7667 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -140,9 +140,10 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
ObjectGesture objectGesture = iter.key();
if (objectGesture.gesture == type) {
foreach (QGesture *g, iter.value()) {
- QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
- m_gestureToRecognizer.remove(g);
- m_obsoleteGestures[recognizer].append(g);
+ if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g)) {
+ m_gestureToRecognizer.remove(g);
+ m_obsoleteGestures[recognizer].insert(g);
+ }
}
}
++iter;
@@ -155,7 +156,14 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
while (iter != m_objectGestures.end()) {
ObjectGesture objectGesture = iter.key();
if (objectGesture.gesture == type && target == objectGesture.object.data()) {
- qDeleteAll(iter.value());
+ QSet<QGesture *> gestures = iter.value().toSet();
+ for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator
+ it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e; ++it) {
+ it.value() -= gestures;
+ }
+ foreach (QGesture *g, gestures)
+ m_deletedRecognizers.remove(g);
+ qDeleteAll(gestures);
iter = m_objectGestures.erase(iter);
} else {
++iter;