Sketcher: EditCoinManager - Check constraint types on updating constraint color

===============================================================================

Problem:
- While SketchObject inhibits intermediate updates during internal command execution, sometimes
a change in the selection (clear selection) in an intermediary step triggers an spurious update colour.

- There will be a final draw and this update colours at the end of the internal command.

- If the types of the constraints changed during the intermediary steps, it may happen that the constraint
coin nodes at a given position no longer correspond to the constraint type in the SketchObject property. This
may cause a attempt to access to a non-existing node or static casting a existing node to the wrong type.

Solution:
- Check the type of the constraint against the cached type. If not matching, cancel the color update.
This commit is contained in:
Abdullah Tahiri
2022-01-09 11:34:28 +01:00
parent 37e93cc167
commit 5279bf68c7

View File

@@ -1266,6 +1266,12 @@ void EditModeConstraintCoinManager::updateConstraintColor(const std::vector<Sket
// Check Constraint Type
Sketcher::Constraint* constraint = constraints[i];
ConstraintType type = constraint->Type;
// It may happen that color updates are triggered by programatic selection changes before a command final update. Then
// constraints may have been changed and the color will be updated as part
if (type != vConstrType[i])
break;
bool hasDatumLabel = (type == Sketcher::Angle ||
type == Sketcher::Radius ||
type == Sketcher::Diameter ||