Sketcher: [skip ci] do not create dialog on heap if not needed to improve exception-safety and reduce possible memory leaks
This commit is contained in:
@@ -775,21 +775,15 @@ void CmdSketcherMirrorSketch::activated(int iMsg)
|
||||
return;
|
||||
}
|
||||
|
||||
// Ask the user the type of mirroring
|
||||
SketchMirrorDialog * smd = new SketchMirrorDialog();
|
||||
|
||||
int refgeoid = -1;
|
||||
Sketcher::PointPos refposid = Sketcher::none;
|
||||
|
||||
if (smd->exec() == QDialog::Accepted) {
|
||||
refgeoid = smd->RefGeoid;
|
||||
refposid = smd->RefPosid;
|
||||
delete smd;
|
||||
}
|
||||
else {
|
||||
delete smd;
|
||||
// Ask the user the type of mirroring
|
||||
SketchMirrorDialog smd;
|
||||
if (smd.exec() != QDialog::Accepted)
|
||||
return;
|
||||
}
|
||||
|
||||
refgeoid = smd.RefGeoid;
|
||||
refposid = smd.RefPosid;
|
||||
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
openCommand("Create a mirrored sketch for each selected sketch");
|
||||
|
||||
@@ -1887,15 +1887,14 @@ void CmdSketcherRectangularArray::activated(int iMsg)
|
||||
}
|
||||
|
||||
// Pop-up asking for values
|
||||
SketchRectangularArrayDialog * slad = new SketchRectangularArrayDialog();
|
||||
SketchRectangularArrayDialog slad;
|
||||
|
||||
if (slad->exec() == QDialog::Accepted) {
|
||||
if (slad.exec() == QDialog::Accepted) {
|
||||
ActivateAcceleratorHandler(getActiveGuiDocument(),
|
||||
new DrawSketchHandlerRectangularArray(geoIdList, LastGeoId, LastPointPos, geoids, slad->Clone,
|
||||
slad->Rows, slad->Cols, slad->ConstraintSeparation,
|
||||
slad->EqualVerticalHorizontalSpacing));
|
||||
new DrawSketchHandlerRectangularArray(geoIdList, LastGeoId, LastPointPos, geoids, slad.Clone,
|
||||
slad.Rows, slad.Cols, slad.ConstraintSeparation,
|
||||
slad.EqualVerticalHorizontalSpacing));
|
||||
}
|
||||
delete slad;
|
||||
}
|
||||
|
||||
bool CmdSketcherRectangularArray::isActive(void)
|
||||
|
||||
Reference in New Issue
Block a user