Fix iterator increment after erase in VisualToolDrag

Originally committed to SVN as r6561.
This commit is contained in:
Thomas Goyne 2012-03-10 02:16:38 +00:00
parent 29662749db
commit 3e3a853a89

View file

@ -157,15 +157,17 @@ void VisualToolDrag::OnSelectedSetChanged(const Selection &added, const Selectio
c->selectionController->GetSelectedSet(selection); c->selectionController->GetSelectedSet(selection);
bool any_changed = false; bool any_changed = false;
for (feature_iterator it = features.begin(); it != features.end(); ++it) { for (feature_iterator it = features.begin(); it != features.end(); ) {
if (removed.count(it->line)) { if (removed.count(it->line)) {
sel_features.erase(it); sel_features.erase(it++);
any_changed = true; any_changed = true;
} }
else if (added.count(it->line) && it->type == DRAG_START && !sel_features.count(it->parent)) { else if (added.count(it->line) && it->type == DRAG_START && !sel_features.count(it->parent)) {
sel_features.insert(it); sel_features.insert(it++);
any_changed = true; any_changed = true;
} }
else
++it;
} }
if (any_changed) if (any_changed)