summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstatemachine.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-05-08 10:59:03 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-05-08 10:59:03 (GMT)
commitf64170262441cce51b52d05a2f2ba2f0021ba8e4 (patch)
treedc22f539a4474064d0604e81db7340d679063c71 /src/corelib/statemachine/qstatemachine.cpp
parent58bf96d7252df3346d0f325af265873897e56172 (diff)
downloadQt-f64170262441cce51b52d05a2f2ba2f0021ba8e4.zip
Qt-f64170262441cce51b52d05a2f2ba2f0021ba8e4.tar.gz
Qt-f64170262441cce51b52d05a2f2ba2f0021ba8e4.tar.bz2
make sure connections and event filters are removed when state machine halts
Diffstat (limited to 'src/corelib/statemachine/qstatemachine.cpp')
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 110a4f8..24af8e4 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1224,10 +1224,12 @@ void QStateMachinePrivate::_q_process()
break;
case Finished:
state = NotRunning;
+ unregisterAllTransitions();
emit q->finished();
break;
case Stopped:
state = NotRunning;
+ unregisterAllTransitions();
emit q->stopped();
break;
}
@@ -1358,6 +1360,20 @@ void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transit
#endif
}
+void QStateMachinePrivate::unregisterAllTransitions()
+{
+ {
+ QList<QSignalTransition*> transitions = qFindChildren<QSignalTransition*>(rootState);
+ for (int i = 0; i < transitions.size(); ++i)
+ unregisterSignalTransition(transitions.at(i));
+ }
+ {
+ QList<QEventTransition*> transitions = qFindChildren<QEventTransition*>(rootState);
+ for (int i = 0; i < transitions.size(); ++i)
+ unregisterEventTransition(transitions.at(i));
+ }
+}
+
#ifndef QT_NO_STATEMACHINE_EVENTFILTER
void QStateMachinePrivate::registerEventTransition(QEventTransition *transition)
{