diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-05-08 10:59:03 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-05-08 10:59:03 (GMT) |
commit | f64170262441cce51b52d05a2f2ba2f0021ba8e4 (patch) | |
tree | dc22f539a4474064d0604e81db7340d679063c71 /src | |
parent | 58bf96d7252df3346d0f325af265873897e56172 (diff) | |
download | Qt-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')
-rw-r--r-- | src/corelib/statemachine/qstatemachine.cpp | 16 | ||||
-rw-r--r-- | src/corelib/statemachine/qstatemachine_p.h | 1 |
2 files changed, 17 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) { diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h index bb4a78c..47b139c 100644 --- a/src/corelib/statemachine/qstatemachine_p.h +++ b/src/corelib/statemachine/qstatemachine_p.h @@ -150,6 +150,7 @@ public: void unregisterEventTransition(QEventTransition *transition); #endif void unregisterTransition(QAbstractTransition *transition); + void unregisterAllTransitions(); void handleTransitionSignal(const QObject *sender, int signalIndex, void **args); void scheduleProcess(); |