Sketch: Bug fix: On delete crash with unsuccesful solving
========================================================== Fixes the one reported by JMG here (Thanks!!): http://forum.freecadweb.org/viewtopic.php?f=3&t=11508#p92693 Why? - The newly introduced redrawing policy requires that the solver geometry matches in number the sketchobject geometry. - Most (all) problems with updateColor or getGeometry returning a null pointer are related to an out of sync between UI geometry and SketchObject geometry. General solution: - In other bugs, a missing "solve()" is the problem, once the solver and sketchobject geometries have the same number, an SketchObject::OnChanged triggers a VPSketch::draw (via VPSketch::updateData) which updates the UI geometry to match SketchObject geometry and then the problem does not arise. Particular solution: - In this bug, the problem is not a missing solve, but the fact that the solving was not succesful and did not synchronize the geometries, however triggering a draw() on unsuccessful solving, syncronizes the UI geometry with the SketchObject geometry and the crash is gone.
This commit is contained in:
parent
3a69c926b5
commit
214169616d
|
@ -4785,10 +4785,18 @@ bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
|||
}
|
||||
}
|
||||
|
||||
getSketchObject()->solve();
|
||||
|
||||
int ret=getSketchObject()->solve();
|
||||
|
||||
if(ret!=0){
|
||||
// if the sketched could not be solved, we first redraw to update the UI geometry as
|
||||
// onChanged did not update it.
|
||||
UpdateSolverInformation();
|
||||
draw();
|
||||
}
|
||||
|
||||
this->drawConstraintIcons();
|
||||
this->updateColor();
|
||||
|
||||
// if in edit not delete the object
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user