summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-11-10 13:12:59 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-11-10 13:19:48 (GMT)
commit75f264cc6c47493f26ee81c783d1f9b64310c1d6 (patch)
tree35e9eb6ebb4f870fe11a858d73399d6f8458d3f4 /demos
parent479e183a2c56eaf65a9734dcd134c534ce5e6642 (diff)
downloadQt-75f264cc6c47493f26ee81c783d1f9b64310c1d6.zip
Qt-75f264cc6c47493f26ee81c783d1f9b64310c1d6.tar.gz
Qt-75f264cc6c47493f26ee81c783d1f9b64310c1d6.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
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;