* use early exit to highlight main execution path
* use `auto*` for pointer
* use getObject<T>() instead of casting result from getObject()
* remove empty updateData()
* rename origin to lcs in setTemporaryVisibility for clarity
This is a left-over of the regressions introduced with PR 18126.
Thanks to some moderinization of the code base and replacing static with dynamic casts undefined behaviour
has changed to well-defined behaviour but now unchecked null pointers.
This change does some extra null pointer checks and uses the now correct types for down casting.
Hint: Upstream still uses many static casts here that already cause undefined behaviour when creating a LCS.
This could be the reason for the possible crashes when deleting a LCS as described in 20261
# Conflicts:
# src/Gui/ViewProviderCoordinateSystem.cpp
Until 8de6382 ("Gui: Fix stackoverflow when loading corrupted file")
a static_cast was used to obtain App::Origin object, however with
introducing App::LocalCoordinateSystem this was no longer correct,
although not causing any troubles as OriginFeatures moved into
LocalCoordinateSystem as well.
Recent use of getObject template triggered this problem, so use now
correct cast to App::LocalCoordinateSystem.
Fixes: 19702dc ("Core: Add App::LocalCoordinateSystem")
If an object has a link to itself it may cause a stackoverflow
in several cases:
* If the method claimChildren3D() returns a list containing the
object of the view provider then Document::handleChildren3D()
will add a SoGroup to itself as a child. This will result into
a stackoverflow as soon as an action traverses the scene.
* If the method claimChildren() returns a list containing the
object of the view provider then DocumentItem::createNewItem()
causes an infinite loop with DocumentItem::populateItem()
Solution:
* Inside Document::handleChildren3D() avoid to add a SoGroup to itself
* In this specific case fix ViewProviderCoordinateSystem::claimChildren()
to avoid a cyclic dependency
Hint: Since PR 18126 FreeCAD is vulnerable for this problem.
This fixes issue 19682