summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-05-07 22:12:09 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2015-05-07 22:12:09 +0000
commita06c4852edb10e38fce19fd2df3833c03b6a15e4 (patch)
treeeeaf2609e71a71657eab53b23a0196d3500b930c /src
parentExporting. Fix for Bug #1452560 (Rectangles missing from saved SIF). (diff)
downloadinkscape-a06c4852edb10e38fce19fd2df3833c03b6a15e4.tar.gz
inkscape-a06c4852edb10e38fce19fd2df3833c03b6a15e4.zip
fix crash when converting a group of objects to path
(bzr r14121)
Diffstat (limited to 'src')
-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, 21 insertions, 7 deletions
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 8d2695b85..98148b916 100644
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
@@ -388,7 +388,9 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>&
if (repr) {
to_select.insert(to_select.begin(),repr);
did = true;
- selected.erase(find(selected.begin(),selected.end(),item));
+ std::vector<SPItem*>::iterator element=find(selected.begin(),selected.end(),item);
+ if(element != selected.end())
+ selected.erase(find(selected.begin(),selected.end(),item));
}
continue;
@@ -413,7 +415,9 @@ sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>&
continue;
did = true;
- selected.erase(find(selected.begin(),selected.end(),item));
+ std::vector<SPItem*>::iterator element=find(selected.begin(),selected.end(),item);
+ if(element != selected.end())
+ selected.erase(element);
// remember the position of the item
gint pos = item->getRepr()->position();
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 8bc62d4b9..3a68b03e5 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -3922,7 +3922,9 @@ 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());
- items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),static_cast<SPObject*>(i->data)));
+ 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);
}
sp_selection_group_impl(reprs_to_group, group, xml_doc, doc);
@@ -3972,7 +3974,9 @@ 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();
- items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),item));
+ 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);
current->parent()->appendChild(group);
sp_repr_unparent(current);
group->appendChild(spnew);
@@ -3996,7 +4000,9 @@ 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);
- items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),item));
+ 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);
}
g_slist_free(items_to_delete);
@@ -4121,7 +4127,9 @@ 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) {
- items_to_select.erase(find(items_to_select.begin(),items_to_select.end(),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);
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 01b75fdb4..0af347bef 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -674,7 +674,9 @@ void EraserTool::set_to_accumulated() {
Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop);
toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints());
}
- toWorkOn.erase(find(toWorkOn.begin(),toWorkOn.end(),acid));
+ std::vector<SPItem*>::iterator element = find(toWorkOn.begin(),toWorkOn.end(),acid);
+ if(element != toWorkOn.end())
+ toWorkOn.erase(element);
} else {
toWorkOn= selection->itemList();
wasSelection = true;