summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-05-07 22:25:20 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2015-05-07 22:25:20 +0000
commitfbe59eb1913a779115d9c4769a4066d08e30ff44 (patch)
tree08bd538216290a15751da775b76500bc4e9eb29a
parentfix crash when converting a group of objects to path (diff)
downloadinkscape-fbe59eb1913a779115d9c4769a4066d08e30ff44.tar.gz
inkscape-fbe59eb1913a779115d9c4769a4066d08e30ff44.zip
better fix, using std::remove instead of std::erase
(bzr r14122)
-rw-r--r--src/path-chemistry.cpp8
-rw-r--r--src/selection-chemistry.cpp16
-rw-r--r--src/ui/tools/eraser-tool.cpp4
3 files changed, 7 insertions, 21 deletions
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 98148b916..ff307cd66 100644
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
@@ -388,9 +388,7 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>&
if (repr) {
to_select.insert(to_select.begin(),repr);
did = true;
- std::vector<SPItem*>::iterator element=find(selected.begin(),selected.end(),item);
- if(element != selected.end())
- selected.erase(find(selected.begin(),selected.end(),item));
+ remove(selected.begin(),selected.end(),item);
}
continue;
@@ -415,9 +413,7 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>&
continue;
did = true;
- std::vector<SPItem*>::iterator element=find(selected.begin(),selected.end(),item);
- if(element != selected.end())
- selected.erase(element);
+ remove(selected.begin(),selected.end(),item);
// remember the position of the item
gint pos = item->getRepr()->position();
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 3a68b03e5..1e3afc6a8 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -3922,9 +3922,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
for (GSList *i = apply_to_items ; NULL != i ; i = i->next) {
reprs_to_group.push_back(static_cast<SPObject*>(i->data)->getRepr());
- std::vector<SPItem*>::iterator element = find(items_to_select.begin(),items_to_select.end(),static_cast<SPObject*>(i->data));
- if(element != items_to_select.end())
- items_to_select.erase(element);
+ remove(items_to_select.begin(),items_to_select.end(),static_cast<SPObject*>(i->data));
}
sp_selection_group_impl(reprs_to_group, group, xml_doc, doc);
@@ -3974,9 +3972,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
Inkscape::XML::Node *spnew = current->duplicate(xml_doc);
gint position = current->position();
- std::vector<SPItem*>::iterator element = find(items_to_select.begin(),items_to_select.end(),item);
- if(element != items_to_select.end())
- items_to_select.erase(element);
+ remove(items_to_select.begin(),items_to_select.end(),item);
current->parent()->appendChild(group);
sp_repr_unparent(current);
group->appendChild(spnew);
@@ -4000,9 +3996,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
for (GSList *i = items_to_delete; NULL != i; i = i->next) {
SPObject *item = reinterpret_cast<SPObject*>(i->data);
item->deleteObject(false);
- std::vector<SPItem*>::iterator element = find(items_to_select.begin(),items_to_select.end(),item);
- if(element != items_to_select.end())
- items_to_select.erase(element);
+ remove(items_to_select.begin(),items_to_select.end(),item);
}
g_slist_free(items_to_delete);
@@ -4127,9 +4121,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
for (GSList *i = items_to_ungroup ; NULL != i ; i = i->next) {
SPGroup *group = dynamic_cast<SPGroup *>(static_cast<SPObject *>(i->data));
if (group) {
- std::vector<SPItem*>::iterator element = find(items_to_select.begin(),items_to_select.end(),group);
- if(element != items_to_select.end())
- items_to_select.erase(element);
+ remove(items_to_select.begin(),items_to_select.end(),group);
std::vector<SPItem*> children;
sp_item_group_ungroup(group, children, false);
items_to_select.insert(items_to_select.end(),children.rbegin(),children.rend());
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index 0af347bef..8a9db6c72 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -674,9 +674,7 @@ void EraserTool::set_to_accumulated() {
Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints());
}
- std::vector<SPItem*>::iterator element = find(toWorkOn.begin(),toWorkOn.end(),acid);
- if(element != toWorkOn.end())
- toWorkOn.erase(element);
+ std::remove(toWorkOn.begin(),toWorkOn.end(),acid);
} else {
toWorkOn= selection->itemList();
wasSelection = true;