X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fsp-root.cpp;h=6ad5ff6385798398609a62eb89c2c6b993c5ba15;hb=b752616506705efd28f22c4d852d198ff40c7026;hp=b3946cfee9bf90d3b640db5db4d71e3ca6a73f60;hpb=bb1ab8eea9097820f8a77145d8e41520348f0260;p=inkscape.git diff --git a/src/sp-root.cpp b/src/sp-root.cpp index b3946cfee..6ad5ff638 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -13,7 +13,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include #include "svg/svg.h" #include "display/nr-arena-group.h" @@ -353,9 +358,9 @@ sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML: (* ((SPObjectClass *) (parent_class))->child_added)(object, child, ref); SPObject *co = object->document->getObjectByRepr(child); - g_assert(co != NULL); + g_assert (co != NULL || !strcmp("comment", child->name())); // comment repr node has no object - if (SP_IS_DEFS(co)) { + if (co && SP_IS_DEFS(co)) { SPObject *c; /* We search for first node - it is not beautiful, but works */ for (c = sp_object_first_child(SP_OBJECT(group)) ; c != NULL; c = SP_OBJECT_NEXT(c) ) { @@ -577,7 +582,8 @@ sp_root_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) SPRoot *root = SP_ROOT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = sp_repr_new("svg:svg"); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); + repr = xml_doc->createElement("svg:svg"); } if (flags & SP_OBJECT_WRITE_EXT) {