[TD] avoid memory leaks by using shared_ptr

TD geometry objects are sometimes double deleted.  This
change uses shared_ptr instead of raw pointers to manage
deletions.
This commit is contained in:
Wanderer Fan
2022-01-02 10:12:56 -05:00
committed by WandererFan
parent 4c9191d489
commit e91cc8e329
34 changed files with 290 additions and 279 deletions

View File

@@ -97,9 +97,9 @@ void QGIDrawingTemplate::draw()
// Clear the previous geometry stored
// Get a list of geometry and iterate
const std::vector<TechDraw::BaseGeom *> &geoms = tmplte->getGeometry();
const TechDraw::BaseGeomPtrVector &geoms = tmplte->getGeometry();
std::vector<TechDraw::BaseGeom *>::const_iterator it = geoms.begin();
TechDraw::BaseGeomPtrVector::const_iterator it = geoms.begin();
QPainterPath path;
@@ -109,7 +109,7 @@ void QGIDrawingTemplate::draw()
switch((*it)->geomType) {
case TechDraw::GENERIC: {
TechDraw::Generic *geom = static_cast<TechDraw::Generic *>(*it);
TechDraw::GenericPtr geom = std::static_pointer_cast<TechDraw::Generic>(*it);
path.moveTo(geom->points[0].x, geom->points[0].y);
std::vector<Base::Vector3d>::const_iterator it = geom->points.begin();