summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Zander <t.zander@nokia.com>2010-08-17 10:56:57 (GMT)
committerThomas Zander <t.zander@nokia.com>2010-08-17 12:35:41 (GMT)
commit81644d683c0c8da3f14f162e31bc55038cb121d7 (patch)
tree316693f7b2e59a8ae2036e517e1c53fe83ef1bdd /src
parent87e9034caf90fb02ae2564947b9cbf464b3ca97c (diff)
downloadQt-81644d683c0c8da3f14f162e31bc55038cb121d7.zip
Qt-81644d683c0c8da3f14f162e31bc55038cb121d7.tar.gz
Qt-81644d683c0c8da3f14f162e31bc55038cb121d7.tar.bz2
Fix memory leak in gesture manager
If the user unregisters a recognizer before anyone ever used it we didn't delete it on application exit. This fix makes sure we do. Task: QTBUG-12845 Reviewed-by: Denis Dzyubenko
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qgesturemanager.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index fe9dd8a..e768a21 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -129,7 +129,12 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r
void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
{
QList<QGestureRecognizer *> list = m_recognizers.values(type);
- m_recognizers.remove(type);
+ while (QGestureRecognizer *recognizer = m_recognizers.take(type)) {
+ if (!m_obsoleteGestures.contains(recognizer)) {
+ // inserting even an empty QSet will cause the recognizer to be deleted on destruction of the manager
+ m_obsoleteGestures.insert(recognizer, QSet<QGesture *>());
+ }
+ }
foreach (QGesture *g, m_gestureToRecognizer.keys()) {
QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
if (list.contains(recognizer)) {