summaryrefslogtreecommitdiffstats
path: root/src/selection.cpp
diff options
context:
space:
mode:
authorTomasz Boczkowski <penginsbacon@gmail.com>2015-05-09 11:38:22 +0000
committerTomasz Boczkowski <penginsbacon@gmail.com>2015-05-09 11:38:22 +0000
commitdb85d12f8c106586a0b11f60bf32cdb8ca75d8f2 (patch)
treeae5cbc2ad4fdbb93dbc1d7fc8b92ee2e2012e853 /src/selection.cpp
parentrenamed SPPattern methods to match coding style (diff)
parentfix crash introduces by recent rev when clipping (diff)
downloadinkscape-db85d12f8c106586a0b11f60bf32cdb8ca75d8f2.tar.gz
inkscape-db85d12f8c106586a0b11f60bf32cdb8ca75d8f2.zip
merged trunk
(bzr r14059.1.21)
Diffstat (limited to 'src/selection.cpp')
-rw-r--r--src/selection.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/selection.cpp b/src/selection.cpp
index 53772c381..7979b5d61 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -178,6 +178,7 @@ void Selection::_add(SPObject *obj) {
// (to prevent double-selection)
_removeObjectDescendants(obj);
_removeObjectAncestors(obj);
+ g_return_if_fail(SP_IS_OBJECT(obj));
_objs.push_front(obj);
_objs_set.insert(obj);
@@ -481,17 +482,21 @@ std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPoints(SnapPreferenc
}
void Selection::_removeObjectDescendants(SPObject *obj) {
+ std::vector<SPObject*> toremove;
for ( std::list<SPObject*>::const_iterator iter=_objs.begin();iter!=_objs.end();iter++ ) {
- SPObject *sel_obj= *iter;
+ SPObject *sel_obj= dynamic_cast<SPObject*>(*iter);
SPObject *parent = sel_obj->parent;
while (parent) {
if ( parent == obj ) {
- _remove(sel_obj);
+ toremove.push_back(sel_obj);
break;
}
parent = parent->parent;
}
}
+ for ( std::vector<SPObject*>::const_iterator iter=toremove.begin();iter!=toremove.end();iter++ ) {
+ _remove(*iter);
+ }
}
void Selection::_removeObjectAncestors(SPObject *obj) {