diff --git a/src/layer-fns.cpp b/src/layer-fns.cpp
index 2d58796af59edf222146080c8ab6b5543e36a7af..75bb89bcf65f49f1d07d542a94839adc7f98f178 100644 (file)
--- a/src/layer-fns.cpp
+++ b/src/layer-fns.cpp
@@ -174,7 +174,8 @@ SPObject *create_layer(SPObject *root, SPObject *layer, LayerRelativePosition po
id = g_strdup_printf("layer%d", layer_suffix++);
} while (document->getObjectById(id));
- Inkscape::XML::Node *repr=sp_repr_new("svg:g");
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+ Inkscape::XML::Node *repr = xml_doc->createElement("svg:g");
repr->setAttribute("inkscape:groupmode", "layer");
repr->setAttribute("id", id);
g_free(id);