> > The use of a reverse for loop does not seem necessary. A forward one would
> be
> > simpler. And even better would be to use a Q_FOREACH.
>
> It *is* necessary because in this loop we are potentially removing the current
> action from the list, thus invalidating greater indexes. Iterating backward
> ensures the current index is always valid without having to resort to complex
> arithmetics.
I had not seen that.
Q_FOREACH would still work in that case because it operates on a copy of the list as soon as it is modified I believe.
> > The use of a reverse for loop does not seem necessary. A forward one would
> be
> > simpler. And even better would be to use a Q_FOREACH.
>
> It *is* necessary because in this loop we are potentially removing the current
> action from the list, thus invalidating greater indexes. Iterating backward
> ensures the current index is always valid without having to resort to complex
> arithmetics.
I had not seen that.
Q_FOREACH would still work in that case because it operates on a copy of the list as soon as it is modified I believe.