crash when scaling a circle, document units = 'm'

Bug #1309225 reported by Alvin Penner on 2014-04-17
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
High
Alvin Penner
lib2geom
Undecided
Unassigned

Bug Description

this is a re-issue of a bug previously noted in Bug 1244861, comment 5.

- Windows XP, Inkscape 13288
- in Document Properties, set default document units to 'm'.
- draw a circle, set the diameter to 0.007 m.
- execute Path->Object to Path, to convert it to arcs.
- save as circle007.svg, attached here
- zoom in, to about 500%
- while holding down Ctrl, grab a corner and decrease radius slightly
- when the diameter is about .006 or .005, note that the circle becomes a 'diamond' or 'square', after releasing the mouse
- while holding down Ctrl, grab a corner and try to increase the radius again
- get a crash with the following console output:

terminate called after throwing an instance of 'Geom::ContinuityError'
  what(): lib2geom exception: Non-contiguous path (src/2geom/path.cpp:386)

(the crash is easy to reproduce, the specific console message does not always appear, maybe shows up half the time)

Alvin Penner (apenner) wrote :
Alvin Penner (apenner) wrote :

re-posting a proposed solution from Bug 1244861, comment 7

This can be fixed in the file 2geom\ellipse.cpp, routine Ellipse::transformed, line 236.
 replace the line:
     if ( are_near(AM.det(), 0) )
 with the line:
     if ( are_near(std::sqrt(AM.det()), 0) )

    This line is used to bypass the normal processing of a circle if the object is too small. The determinant is used to measure the size of the object. Unfortunately, the determinant is a quadratic function of the radius, when the size measurement should be a linear function of radius, so it approaches zero more rapidly than desired at small radius. Taking the square root avoids the problem.
    Unfortunately, this is in 2geom, so I am reluctant to commit this change, thought I would ask for comment here, from anyone who is more familiar with 2geom.

su_v (suv-lp) wrote :

Reproduced with r13289 on OS X 10.7.5.

No meaningful backtrace beyond this:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3fff18
0x000000010063fff2 in geom_cubic_bbox_wind_distance (x000=1907.0000682160608, y000=-3113.4675617756534, x001=-nan(0x8000000000000), y001=inf, x011=-nan(0x8000000000000), y011=-nan(0x8000000000000), x111=-nan(0x8000000000000), y111=-nan(0x8000000000000), pt=@0x7fff5fbfe6a8, bbox=0x0, wind=0x7fff5fbfdff4, best=0x7fff5fbfdff8, tolerance=0.5) at geom.cpp:270
270 const Geom::Coord Px = pt[X];
(gdb) bt
#0 0x000000010063fff2 in geom_cubic_bbox_wind_distance (x000=1907.0000682160608, y000=-3113.4675617756534, x001=-nan(0x8000000000000), y001=inf, x011=-nan(0x8000000000000), y011=-nan(0x8000000000000), x111=-nan(0x8000000000000), y111=-nan(0x8000000000000), pt=@0x7fff5fbfe6a8, bbox=0x0, wind=0x7fff5fbfdff4, best=0x7fff5fbfdff8, tolerance=0.5) at geom.cpp:270
#1 0x0000000100640875 in geom_cubic_bbox_wind_distance (x000=1907.0000682160608, y000=-3113.4675617756534, x001=-nan(0x8000000000000), y001=inf, x011=-nan(0x8000000000000), y011=-nan(0x8000000000000), x111=-nan(0x8000000000000), y111=-nan(0x8000000000000), pt=@0x7fff5fbfe6a8, bbox=0x0, wind=0x7fff5fbfdff4, best=0x7fff5fbfdff8, tolerance=0.5) at geom.cpp:345
...

(last message is repeated endlessly until gdb is cancelled with Ctrl+C)

tags: added: 2geom crash
Changed in inkscape:
importance: Undecided → High
milestone: none → 0.91
status: New → Confirmed
Liam P. White (liampwhite) wrote :

Someone threw ContinuityError and never caught it.

Backtrace: http://paste.ubuntu.com/7272457/

(replaces earlier comment #4 due to excessive length)

su_v (suv-lp) wrote :

lldb log with r13289 attached.

Alvin Penner (apenner) wrote :

fix committed to rev 2183 of lib2geom.
Can be tested by copying the ellipse.cpp file from lib2geom to inkscape repository for temporary test.

Changed in lib2geom:
status: New → Fix Committed
su_v (suv-lp) on 2014-04-21
Changed in inkscape:
status: Confirmed → Triaged
su_v (suv-lp) wrote :

> fix committed to rev 2183 of lib2geom.

Attaching diff from related lib2geom revision to ease teasting with inkscape trunk.

Johan Engelen (johanengelen) wrote :

fix committed to inkscape trunk in rev 13320

Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers