QStateMachine: replace a Q_FOREACH with QSet::op-=

Both 'configuration' and 'pendingErrorStates' are
QSet<QAbstractState*>, so we can use QSet::operator-=
to subtract one from the other. No need to loop
over QSet::remove() here.

Nevermind that QSet::operator-= is really poorly
implemented atm. That needs to be fixed in QSet.

Change-Id: I3f3172ce9a485c4c2abf7d19b831fb0dc1ea61b1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2015-12-24 00:27:39 +01:00
parent eb9fdf7c07
commit 9059931cd2

View File

@ -1499,8 +1499,7 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
pendingErrorStates.insert(currentErrorState);
addDescendantStatesToEnter(currentErrorState, pendingErrorStates, pendingErrorStatesForDefaultEntry);
addAncestorStatesToEnter(currentErrorState, rootState(), pendingErrorStates, pendingErrorStatesForDefaultEntry);
foreach (QAbstractState *s, configuration)
pendingErrorStates.remove(s);
pendingErrorStates -= configuration;
} else {
qWarning("Unrecoverable error detected in running state machine: %s",
qPrintable(errorString));