From b76014b8ef3862b4168148cb20e1108d9c0df5f6 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 12 Jul 2012 01:01:17 +0200 Subject: statemachine: Move invariant code out of loop body The lca variable doesn't change inside the loop. Comparing our implementation to the algorithm in the SCXML spec reveals that this check should indeed be done outside the loop. Change-Id: I5e9824758fd147766e975d107a73561bd7f5a190 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/statemachine/qstatemachine.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/corelib/statemachine') diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index a83737d344..ccc40ac9b4 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -517,12 +517,12 @@ QList QStateMachinePrivate::computeStatesToEnter(const QList lcac = QStatePrivate::get(lca)->childStates(); - foreach (QAbstractState* child,lcac) { - if (!statesToEnter.contains(child)) - addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry); - } + } + if (isParallel(lca)) { + QList lcac = QStatePrivate::get(lca)->childStates(); + foreach (QAbstractState* child,lcac) { + if (!statesToEnter.contains(child)) + addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry); } } } -- cgit v1.2.3