summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-11-10 13:12:59 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-11-13 12:39:22 (GMT)
commitd270d3a32b8d819423f5aef96819014c40b6b7f4 (patch)
treee4c84a1ee974900b89ef690a6d0452ab607f2e84 /demos
parent48a3bd2fb022204c8517eed90d76374298fad9b4 (diff)
downloadQt-d270d3a32b8d819423f5aef96819014c40b6b7f4.zip
Qt-d270d3a32b8d819423f5aef96819014c40b6b7f4.tar.gz
Qt-d270d3a32b8d819423f5aef96819014c40b6b7f4.tar.bz2
Fixes sub-attaq segfault when pausing
The sub-attaq's animation manager was accessing a deleted animation. Task-number: QTBUG-5646 Reviewed-by: thierry (cherry picked from commit 75f264cc6c47493f26ee81c783d1f9b64310c1d6)
Diffstat (limited to 'demos')
-rw-r--r--demos/sub-attaq/animationmanager.cpp7
-rw-r--r--demos/sub-attaq/animationmanager.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/demos/sub-attaq/animationmanager.cpp b/demos/sub-attaq/animationmanager.cpp
index eb5a125..b3fc8e1 100644
--- a/demos/sub-attaq/animationmanager.cpp
+++ b/demos/sub-attaq/animationmanager.cpp
@@ -62,11 +62,18 @@ AnimationManager *AnimationManager::self()
void AnimationManager::registerAnimation(QAbstractAnimation *anim)
{
+ QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*)));
animations.append(anim);
}
+void AnimationManager::unregisterAnimation_helper(QObject *obj)
+{
+ unregisterAnimation(static_cast<QAbstractAnimation*>(obj));
+}
+
void AnimationManager::unregisterAnimation(QAbstractAnimation *anim)
{
+ QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*)));
animations.removeAll(anim);
}
diff --git a/demos/sub-attaq/animationmanager.h b/demos/sub-attaq/animationmanager.h
index 8db13eb..48d84d1 100644
--- a/demos/sub-attaq/animationmanager.h
+++ b/demos/sub-attaq/animationmanager.h
@@ -62,6 +62,9 @@ public slots:
void pauseAll();
void resumeAll();
+private slots:
+ void unregisterAnimation_helper(QObject *obj);
+
private:
static AnimationManager *instance;
QList<QAbstractAnimation *> animations;