View Issue Details

IDProjectCategoryView StatusLast Update
0002504PartDesignBugpublic2017-03-18 20:36
Reporterwmayer Assigned Toickby  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Target Version0.17Fixed in Version0.17 
Summary0002504: Crash in pad function after undoing some operations
DescriptionMaybe this is related to lack of knowledge how to correctly work with the new PartDesign.

In http://forum.freecadweb.org/viewtopic.php?f=9&t=15269 it's said under point 6.) that one can apply e.g. revolutions on a face of a feature.
When doing so on e.g. a pad object then it creates the Revolution object but raises an error dialog that the selected object neither is a sketch nor a Part2DObject.

The Revolution object is not inside the Body feature but outside. When I now use the Migrate command it creates a Part object where all object seems to sorted correctly. Of course, the tip shape is still empty because the revolution is still invalid.

When I run undo three times to go back to the state of the pad object the view is empty but no errors are reported.

When I edit the pad and change some values nothing happens. When I leave edit mode and re-enter it then FreeCAD crashes as soon as I change a value.
Steps To Reproduce1. Create Body, Sketch, Pad
2. Select a face and press Revolve => error
3. Run the Migrate command
4. 3x undo
5. Edit Pad, change a value and leave it
6. Edit Pad again and change a value => crash
Tagsundo
FreeCAD Information

Relationships

related to 0002387 closed FreeCAD Unexpected position when rotating multiple objects 
related to 0002055 closedkkremitzki FreeCAD Undo and redo of fillet restore it incorrectly 

Activities

ickby

2016-04-14 11:42

developer   ~0006963

The Revolution tool seems not to be portet to the new behavior and fails in the creation command. Also the error handling is bad, after failing no object should have been created.

ickby

2016-04-14 11:43

developer   ~0006964

Groove tool shows same behavior

wmayer

2016-04-16 13:15

administrator   ~0006976

This was quite a tricky error because it was hard to locate the code where the actual problem occurred. After spending some hours on it I finally found the problematic location in the source code:
it was crashing inside ViewProviderBody::slotChangedObjectApp because the view provider is a dangling pointer because the boost connection wasn't disconnected when the object has been destroyed.

The regression was caused with commit: https://github.com/FreeCAD/FreeCAD/commit/d4c67c0366e29d47eb4bcfbac1362aa6e589a27c

This crash is fixed now, however, the pad object still doesn't come up again. It looks like the geometry of the sketcher has been erased. When trying to edit sketch it still crashes after a while. There might be a few more boost signals that haven't been disconnected at destruction time.

wmayer

2016-04-16 14:53

administrator   ~0006978

Update on the sketcher:
the geometry list is still intact and also the shape is valid but for any reason the scene graph is (almost) empty. It contains the root node and some switches but all the nodes of any view provider are gone.

The lack of nodes is responsible for the crash when trying to edit the sketch because the mouseMove method uses getPointOnRay which doesn't check for an empty SoPath.

wmayer

2016-04-16 15:38

administrator   ~0006979

The basic problem is that there is no program logic implemented that restores the layout of the scene graph when undoing an operation.

In this case the Migrate command puts the 1st created body feature underneath a 2nd body feature, internally it calls removeViewProvider and puts the root node to the 2nd body feature. The undo then removes the link from the 1st body feature to the 2nd body feature and also reorders the tree view but never calls addViewProvider to put back the root node as top-level node to the scene graph.

Note, this is not related that revolution & groove is not yet ready for the new part design workflow. The same behaviour can be demonstrated when loading an old project with a pad inside. Calling Migrate and Undo makes the pad disappear, too.

DeepSOIC

2016-04-18 14:14

developer   ~0006988

another example to test (simpler):
1. PartDesign workbench: create a Part container.
2. Part workbench: Create a cube
3. In tree view, drag the cube into Part container. So far so good.
4. Drag the cube back out of Part. The cube disappears.
See also http://forum.freecadweb.org/viewtopic.php?f=3&t=15323

wmayer

2017-03-18 20:27

administrator   ~0008647

> another example to test (simpler):
For the sake of completeness the issue reported by DeepSOIC is something different because:
1. the failure of the first issue is about broken undo which is not tested in the second case
2. PR 616 fixes the first issue while the second issue has been fixed in the meantime

wmayer

2017-03-18 20:36

administrator   ~0008648

https://github.com/FreeCAD/FreeCAD/pull/616/commits

Related Changesets

FreeCAD: master 099ceebe

2016-04-16 15:16:00

wmayer

Details Diff
+ issue 0002504: Crash in pad function after undoing some operations Affected Issues
0002504
mod - src/Mod/PartDesign/Gui/ViewProviderBody.cpp Diff File

Issue History

Date Modified Username Field Change
2016-04-14 10:23 wmayer New Issue
2016-04-14 10:23 wmayer Assigned To => ickby
2016-04-14 10:23 wmayer Status new => assigned
2016-04-14 11:42 ickby Note Added: 0006963
2016-04-14 11:42 ickby Status assigned => confirmed
2016-04-14 11:43 ickby Note Added: 0006964
2016-04-16 13:15 wmayer Note Added: 0006976
2016-04-16 13:16 wmayer Changeset attached => FreeCAD Master master 099ceebe
2016-04-16 14:53 wmayer Note Added: 0006978
2016-04-16 15:38 wmayer Note Added: 0006979
2016-04-18 14:14 DeepSOIC Note Added: 0006988
2017-01-17 20:04 Kunda1 Tag Attached: undo
2017-02-04 03:42 Kunda1 Relationship added related to 0002055
2017-02-04 03:45 Kunda1 Relationship added related to 0002387
2017-02-15 09:45 kkremitzki Target Version => 0.17
2017-03-18 20:27 wmayer Note Added: 0008647
2017-03-18 20:36 wmayer Status confirmed => closed
2017-03-18 20:36 wmayer Resolution open => fixed
2017-03-18 20:36 wmayer Fixed in Version => 0.17
2017-03-18 20:36 wmayer Note Added: 0008648