Invalid result when drag and drop svg file

Bug #716362 reported by Deudeu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Johannes Lipp

Bug Description

Inkscape v 0.48
Windows Vista Pro SP2

Description of the bug:
When the attached file is opened vio the Open menu, the black line between the blue circles is well rendered.
When the file is dragged and dropped into Inkscape, the line is not rendered.

Supposed cause:
It seems that the stroke attribute of the <svg> none is not taken into account by the children.
Maybe as this attribute is declared in the <svg> node, it is removed when dragging and dropping.

Expected behavior:
The correct behavior would be to transfer all these attributes to the first child group of the <svg> node.

(Sorry for my english, I'm French)

Tags: importing svg
Revision history for this message
Deudeu (denis-cau) wrote :
Revision history for this message
su_v (suv-lp) wrote :

Reproduced with Inkscape 0.48.0 and 0.48+devel r10039 on OS X 10.5.8

tags: added: importing svg
Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Johannes Lipp (jflipp) wrote :

Here's a patch for this issue (see attached diff file).
I made the diff file from version 0.48 + devel r10087, that is, the current development branch.
I compiled and checked the patch on Windows XP.

The patch changes only one line, namely in source file file.cpp, in function file_import(), there is the line
        if ((style && style->firstChild()) || items_count > 1) {
I changed this to
        if ((style && style->attributeList()) || items_count > 1) {

In function file_import(), the object style is created as
        SPCSSAttr *style = sp_css_attr_from_object(doc->getRoot());
I looked into the function sp_css_attr_from_object() and found that it creates a new, empty object and then fills it with attributes.
So the original check style->firstChild() is always false and can be removed, but the new check style->attributeList() makes sense.

I also looked for other uses of the method style->attributeList() in the Inkscape source code and found that no memory management or reference management is required for the object returned from this method (the object doesn't have to be released, or something similar).

The problem described in the bug report occurs not only when the SVG document is dragged & dropped into the Inkscape document window, but also when the SVG document is imported via the menu item File > Import or the corresponding button in the command bar. The patch fixes the problem in all three cases.

All in all, I think this is a good patch. :-)

As I already said, the patch is for the current development branch (0.49 series).
Should I also provide a patch for the current stable release branch (0.48 series)?
If yes, I have the following question.

Which devlibs do I use to compile and build the current stable release branch?
What I mean is, in bazaar on launchpad, there is the development branch lp:inkspace, and there is the stable release branch lp:inkscape/0.48.x, but there is only one branch lp:inkscape-devlibs.
Do I use the same devlibs to compile and build both the development version and the stable release version?

Thanks for your help.

Revision history for this message
Deudeu (denis-cau) wrote : RE: [Bug 716362] Re: Invalid result when drag and drop svg file
Download full text (3.6 KiB)

Dear Johannes,

Thank you for your efficiency and your good patch!
I agree it is always nice to find a simple and efficient solution!
Don't bother with a patch for the 0.48 branch. I can wait for the 0.49 version :-)

Thanks again,

Denis CAU

-----Message d'origine-----
De : <email address hidden> [mailto:<email address hidden>] De la part de Johannes Lipp
Envoyé : vendredi 11 mars 2011 00:15
À : <email address hidden>
Objet : [Bug 716362] Re: Invalid result when drag and drop svg file

Here's a patch for this issue (see attached diff file).
I made the diff file from version 0.48 + devel r10087, that is, the current development branch.
I compiled and checked the patch on Windows XP.

The patch changes only one line, namely in source file file.cpp, in function file_import(), there is the line
        if ((style && style->firstChild()) || items_count > 1) {
I changed this to
        if ((style && style->attributeList()) || items_count > 1) {

In function file_import(), the object style is created as
        SPCSSAttr *style = sp_css_attr_from_object(doc->getRoot());
I looked into the function sp_css_attr_from_object() and found that it creates a new, empty object and then fills it with attributes.
So the original check style->firstChild() is always false and can be removed, but the new check style->attributeList() makes sense.

I also looked for other uses of the method style->attributeList() in the
Inkscape source code and found that no memory management or reference
management is required for the object returned from this method (the
object doesn't have to be released, or something similar).

The problem described in the bug report occurs not only when the SVG
document is dragged & dropped into the Inkscape document window, but
also when the SVG document is imported via the menu item File > Import
or the corresponding button in the command bar. The patch fixes the
problem in all three cases.

All in all, I think this is a good patch. :-)

As I already said, the patch is for the current development branch (0.49 series).
Should I also provide a patch for the current stable release branch (0.48 series)?
If yes, I have the following question.

Which devlibs do I use to compile and build the current stable release branch?
What I mean is, in bazaar on launchpad, there is the development branch lp:inkspace, and there is the stable release branch lp:inkscape/0.48.x, but there is only one branch lp:inkscape-devlibs.
Do I use the same devlibs to compile and build both the development version and the stable release version?

Thanks for your help.

** Patch added: "Patch"
   https://bugs.launchpad.net/inkscape/+bug/716362/+attachment/1899775/+files/Bugfix716362rev10087series049.diff

--
You received this bug notification because you are a direct subscriber
of the bug.
https://bugs.launchpad.net/bugs/716362

Title:
  Invalid result when drag and drop svg file

Status in Inkscape: A Vector Drawing Tool:
  Confirmed

Bug description:
  Inkscape v 0.48
  Windows Vista Pro SP2

  Description of the bug:
  When the attached file is opened vio the Open menu, the black line between the blue circles is well rendered.
  When the file is dragged and dropped into I...

Read more...

Revision history for this message
jazzynico (jazzynico) wrote :

Patch tested successfully on Windows XP, Inkscape trunk revision 10068.
Thanks Johannes!

Changed in inkscape:
assignee: nobody → Johannes Lipp (jflipp)
milestone: none → 0.49
status: Confirmed → Triaged
Revision history for this message
jazzynico (jazzynico) wrote :

Fix committed in the trunk, revision 10104.

Changed in inkscape:
status: Triaged → Fix Committed
tags: added: backport-proposed
Revision history for this message
jazzynico (jazzynico) wrote :

Patch committed in the 0.48.x branch, revision 9798.

Changed in inkscape:
milestone: 0.49 → 0.48.2
tags: removed: backport-proposed
Ted Gould (ted)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.