Could the fix for this bug be reviewed?

AFAICT the crash occurs when running extensions in documents which use
an arbitrary ID for the node <namedview> (other than what is used in
default templates) -> e.g. when opening PDF files, Plain SVG files, or
other SVG documents which originally didn't have this custom node at all
(Inkscape in such cases assigns a new ID based on its normal scheme:
name of the xml node + a random number).

Apparently the regression was introduced by the patch for 
  Bug #789122 “changing current layer through an extension”
  <https://bugs.launchpad.net/inkscape/+bug/789122>
  <http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/10608>
which AFAIU retrieves  the node <namedview> by the ID it has in default 
templates ("base"). Is the some hidden rule for 'Inkscape SVG' that a 
<namedview> is not a real <namedview> node unless it has the ID "base"? AFAICT 
other parts of Inkscape handle such <namedview> nodes just fine (i.e. are able 
to load the settings independent of the ID).

The current fix for this bug (bug #944077) simply ignores <namedview>
nodes which have a different ID (probably breaking the patch for bug
#789122 for all documents which are not based on the default document).

Isn't there a different way to retrieve the node <namedview> other than
by an (arbitrary) ID "base"?

        SPObject *obj = mydoc->getObjectById("base");

        // Getting the named view from the document generated by the extension
        SPNamedView *nv = (SPNamedView *) obj;

        //Check if it has a default layer set up
        if ( nv != NULL){
            if( nv->default_layer_id != 0 ) {
                SPDocument *document = desktop->doc();
                //If so, get that layer
                layer = 
document->getObjectById(g_quark_to_string(nv->default_layer_id));
            }
        }

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/944077

Title:
  inkscape crashed with SIGSEGV in
  Inkscape::Extension::Implementation::Script::effect()

To manage notifications about this bug go to:
https://bugs.launchpad.net/inkscape/+bug/944077/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to