trunk: unit selector in tool contexts triggers crash on undo of default units change

Bug #1348382 reported by su_v on 2014-07-24
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
High
Alvin Penner

Bug Description

With current trunk, a rectangle which has a custom position of the rotation center resizes unexpectedly if this object is selected while the document default units are changed in the 'Document Properties' dialog.

Steps to reproduce:
1) launch current trunk (default prefs, default new doc, locale: en_US)
2) draw a rect
3) move the rotation center away from default position
4) keep rect selected
5) open 'Document Properties' and change default units (e.g. to 'mm')

Expected result:
The rulers reflect the change of the default units, the object(s) on-canvas stay unchanged (same size & position relative to page area)

Actual result:
The selected object changes in scale when default units are changed.

Inkscape crashes when attempting to undo the latest changes:
6) close 'Document Properties'
7) apply 'Edit > Undo' (or 'Ctrl+Z') twice

--> crash:
**
ERROR:../../src/document-undo.cpp:158:static void Inkscape::DocumentUndo::maybeDone(SPDocument *, const gchar *, const unsigned int, const Glib::ustring &): assertion failed: (doc->priv->sensitive)

Based on tests with archived builds on OS X 10.7.5:
- not reproduced with stable 0.48.4, 0.48.5
- not reproduced with 0.48+devel rev <= 12552
- reproduced with 0.48+devel rev >= 12555;
this regression appears to be related to the merge of the GSoC unit-improvements branch in r12554:
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/changes/12555>

Reproduced with Inkscape 0.48+devel r13466 on OS X 10.7.5.

Related branches

su_v (suv-lp) on 2014-07-24
summary: trunk: rectangle with repositioned rotation center scales if selected
- while document units are changed
+ while document units are changed (rev >= 12554)

The regression appears to be triggered as soon as a rectangle earlier in the stack has a transformed rotation center - any rectangle stacked above and selected while default units are changed will get rescaled.

Alvin Penner (apenner) on 2014-07-27
Changed in inkscape:
status: New → Confirmed
su_v (suv-lp) on 2014-08-08
Changed in inkscape:
importance: Undecided → Medium
su_v (suv-lp) wrote :

Backtrace (crash on undo) attached (Inkscape 0.48+devel r13504, OS X 10.7.5, debug build).

(thx to LiamW for notifying me about the crash on undo)

description: updated
su_v (suv-lp) wrote :

Raising importance (crash when attempting to undo the unexpected changes)

Changed in inkscape:
importance: Medium → High
tags: added: crash
Alvin Penner (apenner) wrote :

attached is a proposed patch for this bug.
This effectively disables all of the center-specific code in the routine SPGroup::scaleChildItemsRec().
I believe it fixes the original bug report.
I cannot tell if it fixes the crash or not, because I have not been able to reproduce the crash.

It does not fix Bug 1247799.
There is still a need for further work to be done in this area because the underlying problem is that the scaling rules for 'inkscape:transform-center-x' are not the same as for 'width', when they should be the same:
- if you scale a rectangle using the mouse then both the 'inkscape:transform-center-x' and 'width' will scale by the same factor, as expected.
- if you scale a rectangle by changing document units, then the numerical value of 'width' will change to the new units, but 'inkscape:transform-center-x' will remain unchanged in numerical value, which is inconsistent. See also https://bugs.launchpad.net/inkscape/+bug/1247799/comments/7

ScislaC (scislac) on 2014-08-16
tags: added: blocker
su_v (suv-lp) wrote :

Sorry for the delay in testing with recent commits:
Based on tests with recent archived builds (on OS X 10.7.5):
- reproduced with r13511
- not reproduced with r13512
this seems to have been fixed too by Diederik's recent commit in revision 13512.
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/13512>

Please reopen if this report was closed in error and can still be reproduced in current trunk >= 13512.

Changed in inkscape:
assignee: nobody → Diederik van Lierop (mail-diedenrezi)
status: Confirmed → Fix Committed
su_v (suv-lp) wrote :

Not fully fixed: still crashes on undo.

Changed in inkscape:
assignee: Diederik van Lierop (mail-diedenrezi) → nobody
status: Fix Committed → Triaged
tags: added: undo
Alvin Penner (apenner) wrote :

Windows XP, running rev 13520, with a little messy patch to allow it to link, crash reproduced

ERROR:src/document-undo.cpp:158:static void Inkscape::DocumentUndo::maybeDone(SPDocument*, const gchar*, unsigned int, const Glib::ustring&): assertion failed:
(doc->priv->sensitive)

Alvin Penner (apenner) wrote :

I should explain the "patch" comment, there is a temporary link error, see

http://inkscape.13.x6.nabble.com/Windows-XP-cannot-compile-rev-13520-td4971192.html

Alvin Penner (apenner) wrote :

the crash can be reproduced even if the center of rotation is kept at its' default value.

- draw rectangle
- change units from px to mm
- select rectangle
- ctrl-Z to undo, get crash

it is not necessary for the rectangle to be selected when changing units, but it is necessary for it to be selected when performing ctrl-Z

Alvin Penner (apenner) wrote :

as far as I can tell, the crash occurs only with rectangles, not with any other shapes

Alvin Penner (apenner) wrote :

what makes the rectangle unique is that the rectangle toolbar has a units selector in it. This units selector is linked to the default document units in the document properties dialog. The linkage is one-way, meaning that a change in rectangle units will not affect the document units, but any change in document units will affect the rectangle units. This linkage is apparently triggering the crash.

Alvin Penner (apenner) wrote :

crash can also be reproduced as follows:

- draw Bezier curve or line
- change default document units
- select node tool F2
- click on a node
- hit ctrl-Z to undo
- get crash message:

ERROR:src/document-undo.cpp:162:static void Inkscape::DocumentUndo::maybeDone(SPDocument*, const gchar*, unsigned int, const Glib::ustring&): assertion failed:
(doc->priv->sensitive)

- also reproduced by using the freehand line (F6) in the first step above
- also reproduced with calligraphy tool (ctrl F6) in first step

su_v (suv-lp) on 2014-08-30
summary: - trunk: rectangle with repositioned rotation center scales if selected
- while document units are changed (rev >= 12554)
+ trunk: unit selector in tool contexts triggers crash on undo of default
+ units change
Alvin Penner (apenner) wrote :

crash avoided by adding new restriction on when updates can occur
committed to rev 13547

Changed in inkscape:
status: Triaged → Fix Committed
su_v (suv-lp) on 2014-09-07
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
su_v (suv-lp) on 2014-09-21
tags: removed: blocker
Bryce Harrington (bryce) on 2015-02-21
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers