Comment 12 for bug 789122

su_v (suv-lp) wrote :

Based on <> I'm proposing to revert this patch (including the later changes to prevent bug #944077) in trunk and stable for now:

AFAIU the id "base" is not reserved for Inkscape's <sodipodi:namedview> object - the patch fails to work as soon as e.g. a different regular object uses this id instead, and/or if <sodipodi:namedview> has a different, autogenerated ID (usually something like "namedview1223"), e.g. if the current SVG document didn't originate in Inkscape itself, or had been saved as 'Plain SVG' at some point, or was converted from one of the supported other vector file formats.

The bug demo extension to change the current layer to a newly added one (with id "my_new_layer"):
- works, if <sodipodi:namedview id="base" …> (file was based on a default template)
- fails [1], if <sodipodi:namedview id="namedview1234" … /> and <rect id=base" … />
- fails, if <sodipodi:namedview id="namedview1234" … /> and no object has id = "base" (crash in

Isn't there a more reliable way to retrieve and set the current layer information from <sodipodi:namedview> without depending on an arbitrary ID?

[1] Console warning from trunk after running the bug demo extension, if a regular object uses the id "base" (and <sodipodi:namedview> has an autogenerated id):
** (inkscape:44023): CRITICAL **: SPObject* SPDocument::getObjectById(const gchar*) const: assertion `id != NULL' failed