X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fsp-use.cpp;h=e31af93564372615836ec57489a1d94e5a62084a;hb=5e230ff5b88fa5522aeaf72d6222c38e4470557d;hp=ae4e9f61a2c451e21f7413115cc073ecdd0cabfd;hpb=86568a2d2943469ff6ec3a00d2fa2b300b5f35ae;p=inkscape.git diff --git a/src/sp-use.cpp b/src/sp-use.cpp index ae4e9f61a..e31af9356 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -241,7 +241,8 @@ sp_use_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) SPUse *use = SP_USE(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = sp_repr_new("svg:use"); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:use"); } if (((SPObjectClass *) (parent_class))->write) { @@ -652,6 +653,7 @@ sp_use_unlink(SPUse *use) Inkscape::XML::Node *parent = sp_repr_parent(repr); SPDocument *document = SP_OBJECT(use)->document; + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); // Track the ultimate source of a chain of uses. SPItem *orig = sp_use_root(use); @@ -661,13 +663,13 @@ sp_use_unlink(SPUse *use) Inkscape::XML::Node *copy = NULL; if (SP_IS_SYMBOL(orig)) { // make a group, copy children - copy = sp_repr_new("svg:g"); + copy = xml_doc->createElement("svg:g"); for (Inkscape::XML::Node *child = SP_OBJECT_REPR(orig)->firstChild() ; child != NULL; child = child->next()) { - Inkscape::XML::Node *newchild = child->duplicate(); + Inkscape::XML::Node *newchild = child->duplicate(xml_doc); copy->appendChild(newchild); } } else { // just copy - copy = SP_OBJECT_REPR(orig)->duplicate(); + copy = SP_OBJECT_REPR(orig)->duplicate(xml_doc); } // Add the duplicate repr just after the existing one.