* Move back util functions to AssemblyUtils again
* Add getPropertyByName<T>() helper
* Improve constness in AssemblyUtils
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add FC_ERR macro for the 'Solve failed' Assembly error
* Handle standard exceptions during assembly solve
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Assembly: removal of object of fixed joint causing crash
FreeCAD is crashing if the 'Object'
property of fixed joint (Assembly/Joints/Fixed/Joint Connector 1/Object1 or
Assembly/Joints/Fixed/Joint Connector 2/Object2) is manually removed.
Steps to reproduce:
- make simple Assembly e.g. of two cubes with Fixed joint
- Select Fixed joint in the tree and go-to property 'Data' tab
- Select 'Object1' or 'Object2' of the 'Joint Connector 1' or 'Joint Connector 2'
and remove this reference
- click by your pointing device (mouse) to the arbitrary other property
The FreeCAD will crash here because the call
App::DocumentObject* obj = getObjFromNameProp(joint, propObjName, propPartName);
will return NULL pointer.
This problem is similar to the
8d5348ad066aa216c387582bfdcf066966a4fe09.
* Assembly: fixed warning message text
The warning message text is not describing two cases which can happen,
but only one - property of specific joint.
* Assembly: avoiding possible crash in rack pinion joint code
Similar problems:
07c6df61f8456a6b02e88b369dcef5643ac1574e
and
8d5348ad066aa216c387582bfdcf066966a4fe09
were causing real crashes (Linux + Sway Wayland compositor) when
Fixed joint type was used.
This patch tries to avoid the same situation, but now for the
rack pinion joint type.
The returned pointer value (part1 and obj1) can get NULL pointer value
and is used in the code:
if (obj1->getNameInDocument() != part1->getNameInDocument()) { ....
a few lines later.
FreeCAD is crashing during 'Solve Assembly' call if the Part property
(Assembly/Joints/Fixed/Joint Connector 1/Part1 or Assembly/Joints/Fixed/Joint
Connector 2/Part2) of fixed Joint is unset.
Steps to reproduce:
- make simple Assembly e.g. of two cubes with Fixed joint
- Select Fixed joint in the tree and go-to property 'Data' tab
- Select Part1 or Part2 of 'Joint Connector 1' or 'Joint Connector 2'
and remove this reference
- call 'Solve Assembly' now
The FreeCAD will crash here because the call
App::DocumentObject* part = getLinkObjFromProp(joint, propPartName);
will return NULL pointer.
The property Part1 or Part2 can get empty (unset) during usual
construction operations - during changing construction history
and it can be very hard to find the cause of FreeCAD crash on a big
model.
This patch tries to fix the crash in such situation.