-void HostL07Model::updateActionsState(double /*now*/, double delta) {
-
- L07Action *action;
- ActionList *actionSet = getRunningActionSet();
- ActionList::iterator it(actionSet->begin());
- ActionList::iterator itNext = it;
- ActionList::iterator itend(actionSet->end());
-
- for (; it != itend; it = itNext) {
- ++itNext;
- action = static_cast<L07Action*>(&*it);
- if (action->latency_ > 0) {
- if (action->latency_ > delta) {
- double_update(&(action->latency_), delta, sg_surf_precision);
+void HostL07Model::update_actions_state(double /*now*/, double delta)
+{
+ for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
+ L07Action& action = static_cast<L07Action&>(*it);
+ ++it; // increment iterator here since the following calls to action.finish() may invalidate it
+ if (action.latency_ > 0) {
+ if (action.latency_ > delta) {
+ double_update(&(action.latency_), delta, sg_surf_precision);