various fixes from pr813:

fix crash due to invalifated iterator
minor performance improvement
do not connect twice automatically connected signal-slot
fix compiler warning
This commit is contained in:
wmayer
2017-06-18 21:25:31 +02:00
parent b1495bdf38
commit 5475368ea4
2 changed files with 4 additions and 5 deletions

View File

@@ -215,6 +215,7 @@ void removeRedundantHorizontalVertical(Sketcher::SketchObject* psketch,
for(std::vector<AutoConstraint>::reverse_iterator it = sug2.rbegin(); it!=sug2.rend(); ++it) {
if( (*it).Type == Sketcher::Horizontal || (*it).Type == Sketcher::Vertical) {
sug2.erase(std::next(it).base());
it = sug2.rbegin(); // erase invalidates the iterator
}
}
}
@@ -348,13 +349,13 @@ public:
removeRedundantHorizontalVertical(static_cast<Sketcher::SketchObject *>(sketchgui->getObject()),sugConstr1,sugConstr2);
// add auto constraints for the line segment start
if (sugConstr1.size() > 0) {
if (!sugConstr1.empty()) {
createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::start);
sugConstr1.clear();
}
// add auto constraints for the line segment end
if (sugConstr2.size() > 0) {
if (!sugConstr2.empty()) {
createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::end);
sugConstr2.clear();
}

View File

@@ -56,8 +56,6 @@ SketcherGeneralWidget::SketcherGeneralWidget(QWidget *parent)
this, SIGNAL(emitToggleAutoconstraints(int)));
connect(ui->renderingOrder->model(), SIGNAL(layoutChanged()),
this, SLOT(renderOrderChanged()));
connect(ui->checkBoxRedundantAutoconstraints, SIGNAL(stateChanged(int)),
this, SLOT(on_checkBoxRedundantAutoconstraints_stateChanged(int)));
}
SketcherGeneralWidget::~SketcherGeneralWidget()
@@ -159,7 +157,7 @@ void SketcherGeneralWidget::renderOrderChanged()
emitRenderOrderChanged();
}
void SketcherGeneralWidget::on_checkBoxRedundantAutoconstraints_stateChanged(int state)
void SketcherGeneralWidget::on_checkBoxRedundantAutoconstraints_stateChanged(int /*state*/)
{
ui->checkBoxRedundantAutoconstraints->onSave();
}