summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/document-properties.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2014-04-04 18:12:04 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2014-04-04 18:12:04 +0000
commitf337f7705f290ecef1790c75f8f94c85e13777b2 (patch)
tree664b0b88cbeff00f8e901252db06d04945f54dbb /src/ui/dialog/document-properties.cpp
parentOnly apply the offset zoom when the document units match the zoom units (diff)
downloadinkscape-f337f7705f290ecef1790c75f8f94c85e13777b2.tar.gz
inkscape-f337f7705f290ecef1790c75f8f94c85e13777b2.zip
fix crash. Iterating through a list to find an object is not necessary, SPDoc provides method for obtaining SPObj from idstring. The crash probably happened because deleting the object invalidated the list iterated (partly).
Fixed bugs: - https://launchpad.net/bugs/1302079 (bzr r13265)
Diffstat (limited to 'src/ui/dialog/document-properties.cpp')
-rw-r--r--src/ui/dialog/document-properties.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 67e788e21..2674efc1e 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -1236,23 +1236,16 @@ void DocumentProperties::removeEmbeddedScript(){
}
}
- const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" );
- while ( current ) {
- if (current->data && SP_IS_OBJECT(current->data)) {
- SPObject* obj = SP_OBJECT(current->data);
- if (id == obj->getId()){
-
- //XML Tree being used directly here while it shouldn't be.
- Inkscape::XML::Node *repr = obj->getRepr();
- if (repr){
- sp_repr_unparent(repr);
-
- // inform the document, so we can undo
- DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script"));
- }
- }
+ SPObject* obj = SP_ACTIVE_DOCUMENT->getObjectById(id);
+ if (obj) {
+ //XML Tree being used directly here while it shouldn't be.
+ Inkscape::XML::Node *repr = obj->getRepr();
+ if (repr){
+ sp_repr_unparent(repr);
+
+ // inform the document, so we can undo
+ DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, _("Remove embedded script"));
}
- current = g_slist_next(current);
}
populate_script_lists();