From 341cf32369ae3f73462430200f818341b942537b Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 12 Mar 2022 19:55:38 +0100 Subject: [PATCH] Sketcher: Coverity 332685, 332686, 332696 ========================================= Detected by coverity as unchanged variable (constant intended). It was actually an unnecessary variable that prevented correct command committing. --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 72e98d5b0b..97bf3daa0a 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -92,7 +92,7 @@ bool isCreateConstraintActive(Gui::Document *doc) } // Utility method to avoid repeating the same code over and over again -void finishDatumConstraint (Gui::Command* cmd, Sketcher::SketchObject* sketch, bool isDriven=true, unsigned int numberofconstraints = 1) +void finishDatumConstraint (Gui::Command* cmd, Sketcher::SketchObject* sketch, bool isDriving=true, unsigned int numberofconstraints = 1) { ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); @@ -138,7 +138,7 @@ void finishDatumConstraint (Gui::Command* cmd, Sketcher::SketchObject* sketch, b bool show = hGrp->GetBool("ShowDialogOnDistanceConstraint", true); // Ask for the value of the distance immediately - if (show && isDriven) { + if (show && isDriving) { EditDatumDialog editDatumDialog(sketch, ConStr.size() - 1); editDatumDialog.exec(); } @@ -4920,7 +4920,6 @@ void CmdSketcherConstrainRadius::applyConstraint(std::vector &selSeq, int GeoId = selSeq.at(0).GeoId; double radius = 0.0; - bool commitNeeded=false; bool updateNeeded=false; switch (seqIndex) { @@ -4969,8 +4968,7 @@ void CmdSketcherConstrainRadius::applyConstraint(std::vector &selSeq, //updateActive(); getSelection().clearSelection(); - if(commitNeeded) - commitCommand(); + commitCommand(); if(updateNeeded) { tryAutoRecomputeIfNotSolve(Obj); // we have to update the solver after this aborted addition. @@ -5199,7 +5197,6 @@ void CmdSketcherConstrainDiameter::applyConstraint(std::vector &selSe int GeoId = selSeq.at(0).GeoId; double diameter = 0.0; - bool commitNeeded=false; bool updateNeeded=false; switch (seqIndex) { @@ -5245,8 +5242,7 @@ void CmdSketcherConstrainDiameter::applyConstraint(std::vector &selSe //updateActive(); getSelection().clearSelection(); - if(commitNeeded) - commitCommand(); + commitCommand(); if(updateNeeded) { tryAutoRecomputeIfNotSolve(Obj); // we have to update the solver after this aborted addition. @@ -5506,7 +5502,6 @@ void CmdSketcherConstrainRadiam::applyConstraint(std::vector &selSeq, int GeoId = selSeq.at(0).GeoId; double radiam = 0.0; - bool commitNeeded=false; bool updateNeeded=false; bool isCircle = false; @@ -5560,8 +5555,7 @@ void CmdSketcherConstrainRadiam::applyConstraint(std::vector &selSeq, //updateActive(); getSelection().clearSelection(); - if(commitNeeded) - commitCommand(); + commitCommand(); if(updateNeeded) { tryAutoRecomputeIfNotSolve(Obj); // we have to update the solver after this aborted addition.