From: johanengelen Date: Fri, 11 Jul 2008 15:35:35 +0000 (+0000) Subject: apply patch by Stefaan, fixes bug #168589 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=adaf1e84bb10c6a8531b58dad7a1290d23c8c17c;p=inkscape.git apply patch by Stefaan, fixes bug #168589 --- diff --git a/src/nodepath.cpp b/src/nodepath.cpp index b712539ab..8bd7787e1 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -885,17 +885,23 @@ static Inkscape::NodePath::Node *sp_nodepath_node_break(Inkscape::NodePath::Node Inkscape::NodePath::SubPath *newsubpath = sp_nodepath_subpath_new(np); // duplicate the break node as start of the new subpath - Inkscape::NodePath::Node *newnode = sp_nodepath_node_new(newsubpath, NULL, (Inkscape::NodePath::NodeType)node->type, NR_MOVETO, &node->pos, &node->pos, &node->n.pos); - - while (node->n.other) { // copy the remaining nodes into the new subpath - Inkscape::NodePath::Node *n = node->n.other; - Inkscape::NodePath::Node *nn = sp_nodepath_node_new(newsubpath, NULL, (Inkscape::NodePath::NodeType)n->type, (NRPathcode)n->code, &n->p.pos, &n->pos, &n->n.pos); - if (n->selected) { - sp_nodepath_node_select(nn, TRUE, TRUE); //preserve selection - } - sp_nodepath_node_destroy(n); // remove the point on the original subpath + Inkscape::NodePath::Node *newnode = sp_nodepath_node_new(newsubpath, NULL, (Inkscape::NodePath::NodeType)node->type, NR_MOVETO, &node->pos, &node->pos, &node->n.pos); + + // attach rest of curve to new node + g_assert(node->n.other); + newnode->n.other = node->n.other; node->n.other = NULL; + newnode->n.other->p.other = newnode; + newsubpath->last = sp->last; + sp->last = node; + node = newnode; + while (node->n.other) { + node = node->n.other; + node->subpath = newsubpath; + sp->nodes = g_list_remove(sp->nodes, node); + newsubpath->nodes = g_list_prepend(newsubpath->nodes, node); } + return newnode; } } @@ -1985,13 +1991,15 @@ void sp_node_selected_break(Inkscape::NodePath::Path *nodepath) { if (!nodepath) return; + GList *tempin = g_list_copy(nodepath->selected); GList *temp = NULL; - for (GList *l = nodepath->selected; l != NULL; l = l->next) { + for (GList *l = tempin; l != NULL; l = l->next) { Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data; Inkscape::NodePath::Node *nn = sp_nodepath_node_break(n); if (nn == NULL) continue; // no break, no new node temp = g_list_prepend(temp, nn); } + g_list_free(tempin); if (temp) { sp_nodepath_deselect(nodepath);