summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstatemachine.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2015-07-14 11:06:40 +0200
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2015-07-23 07:36:38 +0000
commit795476c41a5d45009d3f3aaa00631a1e19bf02cf (patch)
treef2f3e011dc3afd30f37d5e43a2d3752e10d8c7a5 /src/corelib/statemachine/qstatemachine.cpp
parentd348d40473d44720cc5c7e63962ae448149e9549 (diff)
QStateMachine: remove left-over method.
This method was probably there in older versions of the specification, but it is no longer used now. The only caller was in QStateMachinePrivate::setError, which has been changed to use the newer methods. Change-Id: Ic4961990d8d2c902676e63193d3f30ef427e6f0c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/corelib/statemachine/qstatemachine.cpp')
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp70
1 files changed, 5 insertions, 65 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index d1a98d96f5..335610dac6 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1041,69 +1041,6 @@ void QStateMachinePrivate::enterStates(QEvent *event, const QList<QAbstractState
// qDebug() << "configuration:" << configuration.toList();
}
-void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root,
- QSet<QAbstractState*> &statesToEnter,
- QSet<QAbstractState*> &statesForDefaultEntry)
-{
- if (QHistoryState *h = toHistoryState(s)) {
- QList<QAbstractState*> hconf = QHistoryStatePrivate::get(h)->configuration;
- if (!hconf.isEmpty()) {
- for (int k = 0; k < hconf.size(); ++k) {
- QAbstractState *s0 = hconf.at(k);
- addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry);
- }
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": restoring"
- << ((QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory) ? "deep" : "shallow")
- << "history from" << s << ':' << hconf;
-#endif
- } else {
- QList<QAbstractState*> hlst;
- if (QHistoryStatePrivate::get(h)->defaultState)
- hlst.append(QHistoryStatePrivate::get(h)->defaultState);
-
- if (hlst.isEmpty()) {
- setError(QStateMachine::NoDefaultStateInHistoryStateError, h);
- } else {
- for (int k = 0; k < hlst.size(); ++k) {
- QAbstractState *s0 = hlst.at(k);
- addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry);
- }
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": initial history targets for" << s << ':' << hlst;
-#endif
- }
- }
- } else {
- if (s == rootState()) {
- // Error has already been set by exitStates().
- Q_ASSERT(error != QStateMachine::NoError);
- return;
- }
- statesToEnter.insert(s);
- if (isParallel(s)) {
- QState *grp = toStandardState(s);
- QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates();
- for (int i = 0; i < lst.size(); ++i) {
- QAbstractState *child = lst.at(i);
- addStatesToEnter(child, grp, statesToEnter, statesForDefaultEntry);
- }
- } else if (isCompound(s)) {
- statesForDefaultEntry.insert(s);
- QState *grp = toStandardState(s);
- QAbstractState *initial = grp->initialState();
- if (initial != 0) {
- Q_ASSERT(initial->machine() == q_func());
- addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry);
- } else {
- setError(QStateMachine::NoInitialStateError, grp);
- return;
- }
- }
- addAncestorStatesToEnter(s, root, statesToEnter, statesForDefaultEntry);
- }
-}
-
/* The algorithm as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ has a bug. See
* QTBUG-44963 for details. The algorithm here is as described in
* http://www.w3.org/Voice/2013/scxml-irp/SCXML.htm as of Friday March 13, 2015.
@@ -1545,8 +1482,11 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
#ifdef QSTATEMACHINE_DEBUG
qDebug() << q << ": entering error state" << currentErrorState << "from" << currentContext;
#endif
- QState *lca = findLCA(QList<QAbstractState*>() << currentErrorState << currentContext);
- addStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry);
+ pendingErrorStates.insert(currentErrorState);
+ addDescendantStatesToEnter(currentErrorState, pendingErrorStates, pendingErrorStatesForDefaultEntry);
+ addAncestorStatesToEnter(currentErrorState, rootState(), pendingErrorStates, pendingErrorStatesForDefaultEntry);
+ foreach (QAbstractState *s, configuration)
+ pendingErrorStates.remove(s);
} else {
qWarning("Unrecoverable error detected in running state machine: %s",
qPrintable(errorString));