diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index ba5719770b..3941a9cd20 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -247,16 +247,22 @@ int SketchObject::delGeometry(int GeoNbr) for (std::vector::const_iterator it = constraints.begin(); it != constraints.end(); ++it) { if ((*it)->First != GeoNbr && (*it)->Second != GeoNbr) { - if ((*it)->First > GeoNbr) - (*it)->First -= 1; - if ((*it)->Second > GeoNbr) - (*it)->Second -= 1; - newConstraints.push_back(*it); + Constraint *copiedConstr = (*it)->clone(); + if (copiedConstr->First > GeoNbr) + copiedConstr->First -= 1; + if (copiedConstr->Second > GeoNbr) + copiedConstr->Second -= 1; + newConstraints.push_back(copiedConstr); } } - this->Constraints.setValues(newConstraints); + // temporarily empty constraints list in order to avoid invalid constraints + // during manipulation of the geometry list + std::vector< Constraint * > emptyConstraints(0); + this->Constraints.setValues(emptyConstraints); + this->Geometry.setValues(newVals); + this->Constraints.setValues(newConstraints); rebuildVertexIndex(); return 0; } diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 25c50e4e79..853dab5d35 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -1483,6 +1483,7 @@ float ViewProviderSketch::getScaleFactor() return 1.f; } } + void ViewProviderSketch::draw(bool temp) { assert(edit); @@ -1669,7 +1670,7 @@ Restart: // get the geometry const Part::Geometry *geo = (*geomlist)[Constr->First]; // Vertical can only be a GeomLineSegment - assert(geo->getTypeId()== Part::GeomLineSegment::getClassTypeId()); + assert(geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()); const Part::GeomLineSegment *lineSeg = dynamic_cast(geo); // calculate the half distance between the start and endpoint @@ -2938,7 +2939,6 @@ Sketcher::SketchObject *ViewProviderSketch::getSketchObject(void) const return dynamic_cast(pcObject); } - bool ViewProviderSketch::onDelete(const std::vector &subList) { //FIXME use the selection subelements instead of the Sel Sets...