diff options
| author | bulia byak <buliabyak@gmail.com> | 2006-05-12 20:09:24 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2006-05-12 20:09:24 +0000 |
| commit | 0e55ccdbffca14238d59e0bd1dd7a945a578c1b9 (patch) | |
| tree | 29c03bf5f13ccfb2bd983d02592be3f7568b71f1 /src/nodepath.cpp | |
| parent | fix undo bug in nodepath_preserve; fix crash caused by nodepath_cleanup delet... (diff) | |
| download | inkscape-0e55ccdbffca14238d59e0bd1dd7a945a578c1b9.tar.gz inkscape-0e55ccdbffca14238d59e0bd1dd7a945a578c1b9.zip | |
memleak; move deleting empty paths until after all nodes are deleted
(bzr r813)
Diffstat (limited to 'src/nodepath.cpp')
| -rw-r--r-- | src/nodepath.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 9be8b4ff2..4a9493483 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -1870,28 +1870,35 @@ void sp_node_delete_preserve(GList *nodes_to_delete) sp_nodepath_update_handles(nodepath); + if (!g_slist_find(nodepaths, nodepath)) + nodepaths = g_slist_prepend (nodepaths, nodepath); + } + + for (GSList *i = nodepaths; i; i = i->next) { + // FIXME: when/if we teach node tool to have more than one nodepath, deleting nodes from + // different nodepaths will give us one undo event per nodepath + Inkscape::NodePath::Path *nodepath = (Inkscape::NodePath::Path *) i->data; // if the entire nodepath is removed, delete the selected object. if (nodepath->subpaths == NULL || + //FIXME: a closed path CAN legally have one node, it's only an open one which must be + //at least 2 sp_nodepath_get_node_count(nodepath) < 2) { SPDocument *document = sp_desktop_document (nodepath->desktop); sp_nodepath_destroy(nodepath); g_list_free(nodes_to_delete); nodes_to_delete = NULL; - //is the next line necessary? + //FIXME: The following line will be wrong when we have mltiple nodepaths: we only want to + //delete this nodepath's object, not the entire selection! (though at this time, this + //does not matter) sp_selection_delete(); sp_document_done (document); - return; + } else { + sp_nodepath_update_repr(nodepath); + sp_nodepath_update_statusbar(nodepath); } - - if (!g_slist_find(nodepaths, nodepath)) - nodepaths = g_slist_prepend (nodepaths, nodepath); } - for (GSList *i = nodepaths; i; i = i->next) { - Inkscape::NodePath::Path *nodepath = (Inkscape::NodePath::Path *) i->data; - sp_nodepath_update_repr(nodepath); - sp_nodepath_update_statusbar(nodepath); - } + g_slist_free (nodepaths); } /** |
