diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-05-07 09:40:40 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-05-07 09:40:40 (GMT) |
commit | 576dca0086b1566eafe9a24cf5946f46f4e857bf (patch) | |
tree | bc2c310f1afec94e52c733a6c02af03cafe310c2 /tests/auto | |
parent | 74cdd7c31e91e15d5941ece11a6bdf1c4e1b2309 (diff) | |
download | Qt-576dca0086b1566eafe9a24cf5946f46f4e857bf.zip Qt-576dca0086b1566eafe9a24cf5946f46f4e857bf.tar.gz Qt-576dca0086b1566eafe9a24cf5946f46f4e857bf.tar.bz2 |
Fix infinite loop when source and target of transition are in different trees
The SCXML algorithm depends on the guarantee that there is always an LCA
regardless of the state list. The case where the targets are in a different
tree than the source (e.g. if you have not given the target state a parent) is
a bug. The fix is to set an error when this happens in exitStates() and exit
states as if the pending error states were the target states. In enterStates
we will detect the error and skip the step of selecting states to enter, and
instead just enter the pending error states. This breaks transitions to and
from the root state, which is not supported by the SCXML algorithm.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qstatemachine/tst_qstatemachine.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 8026d6e..e7ea403 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -919,8 +919,6 @@ void tst_QStateMachine::brokenStateIsNeverEntered() void tst_QStateMachine::transitionToStateNotInGraph() { - QSKIP("Hangs", SkipAll); - s_countWarnings = false; QStateMachine machine; @@ -930,13 +928,14 @@ void tst_QStateMachine::transitionToStateNotInGraph() machine.setInitialState(initialState); QState *independentState = new QState(); + independentState->setObjectName("independentState"); initialState->addTransition(independentState); machine.start(); QCoreApplication::processEvents(); QCOMPARE(machine.configuration().count(), 1); - QVERIFY(machine.configuration().contains(initialState)); + QVERIFY(machine.configuration().contains(qobject_cast<QState*>(machine.rootState())->errorState())); } void tst_QStateMachine::customErrorStateNotInGraph() |