diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-08-01 10:28:10 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-01 15:37:46 +0200 |
commit | 3a2bc9530e1ace629c37c708e0f0f1b2ca3ed05c (patch) | |
tree | b4a86df07793074fe4f3faa6e8938514c04d5453 /src/corelib | |
parent | 305cdc7355c4b021cfe54c710aa92a88e12fe188 (diff) |
statemachine: Make states exit order spec-compliant
The SCXML spec states that entry order should be equivalent to
"document order" and exit order should be "reverse document order".
Since QStateMachine uses child order for the entry order, the exit
order should be reverse child order.
Change-Id: Ia7b05fdd5c9261ccf202f64f8d23f5c88b20a8c3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/statemachine/qstatemachine.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index b6973881d5..1fe7f96b3c 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -274,8 +274,8 @@ bool QStateMachinePrivate::stateEntryLessThan(QAbstractState *s1, QAbstractState bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState *s2) { if (s1->parent() == s2->parent()) { - return s1->parent()->children().indexOf(s1) - < s2->parent()->children().indexOf(s2); + return s2->parent()->children().indexOf(s2) + < s1->parent()->children().indexOf(s1); } else if (isDescendantOf(s1, s2)) { return true; } else if (isDescendantOf(s2, s1)) { @@ -285,7 +285,7 @@ bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2); Q_ASSERT(lca != 0); - return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); + return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1)); } } |