From ea698474d5d284f4ec7c33dc70d3a54143dc6ca4 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Mon, 10 Apr 2017 17:17:11 +0200 Subject: [PATCH] Sketcher: addGeometry list addition using copy to avoid copying tags --- src/Mod/Sketcher/App/SketchObject.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index f166d8b734..b953884ce1 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -624,16 +624,24 @@ int SketchObject::addGeometry(const std::vector &geoList, bool const std::vector< Part::Geometry * > &vals = getInternalGeometry(); std::vector< Part::Geometry * > newVals(vals); + std::vector< Part::Geometry * > copies; + copies.reserve(geoList.size()); for (std::vector::const_iterator it = geoList.begin(); it != geoList.end(); ++it) { - if(construction && (*it)->getTypeId() != Part::GeomPoint::getClassTypeId()) - const_cast(*it)->Construction = construction; - - newVals.push_back(*it); + Part::Geometry* copy = (*it)->copy(); + if(construction && copy->getTypeId() != Part::GeomPoint::getClassTypeId()) { + copy->Construction = construction; + } + + copies.push_back(copy); } + + newVals.insert(newVals.end(), copies.begin(), copies.end()); Geometry.setValues(newVals); + for (std::vector::iterator it = copies.begin(); it != copies.end(); ++it) + delete *it; Constraints.acceptGeometry(getCompleteGeometry()); rebuildVertexIndex(); - + return Geometry.getSize()-1; }