demos/sub-attaq/animationmanager.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/demos/sub-attaq/animationmanager.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/demos/sub-attaq/animationmanager.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -62,11 +62,18 @@
 
 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);
 }