Bug #2561: SIGSEGV while moving an entity from a body to an other one

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Bug #2561: SIGSEGV while moving an entity from a body to an other one

Post by Kunda1 »

issue #2561: SIGSEGV while moving an entity from a body to an other one
Description
This apply to latest git master version (I've not found it in "Product version" box.

Version: 0.17
Revision: 7667 (git)

FreeCAD crashes with e SIGSEGV while moving a box from a body to another one in the same part.

Steps To Reproduce
I start in PartDesign
- Create a new part
- Create 3 bodies under this part
- Create a box in the third body
- Move the box from the 3rd body to the first one
(right click -> move object to another body -> choose the 1st in the list)
---> Crash

Code: Select all

** Abort *** an exception was raised, but no catch was found.
    ... The exception is:SIGSEGV 'segmentation violation' detected. Address 1a0[/quote]
@wmayer confirmed the bug and wrote:
wmayer wrote:The crash happens in the method CmdPartDesignMoveFeature::activated on line 636:

Code: Select all

    App::DocumentObject * sourceNewTip = source->Tip.getValue();
> doCommand(Gui,"Gui.activeDocument().show(\"%s\")", sourceNewTip->getNameInDocument());
because 'sourceNewTip ' is a nullptr. Btw, to me this block doesn't make much sense anyway because in line 619 the Tip is removed from 'source' but nothing has been added to it. So, why is there a second call to get its Tip (when it actually must be null).

The code can be easily fixed by adding

Code: Select all

    App::DocumentObject * sourceNewTip = source->Tip.getValue();
    if (sourceNewTip)
        doCommand(Gui,"Gui.activeDocument().show(\"%s\")", sourceNewTip->getNameInDocument());
but when trying the example with the three bodies and a box, the box will be moved but not its attached coordinate system. So, to me it seems more things are broken in this command (or I don't understand the logic :) ).
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply