From 2e41e3f656cbb11212a7b3815efdc21655c1f23d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 28 Jun 2013 14:21:43 +0000 Subject: [PATCH] From Gill Peacegood, "fix for a memory leak in the DelaunayConstraint class" --- include/osgUtil/DelaunayTriangulator | 2 +- src/osgUtil/DelaunayTriangulator.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/osgUtil/DelaunayTriangulator b/include/osgUtil/DelaunayTriangulator index 9e50dd829..4c01d0268 100644 --- a/include/osgUtil/DelaunayTriangulator +++ b/include/osgUtil/DelaunayTriangulator @@ -95,7 +95,7 @@ public: void handleOverlaps(void); protected: - virtual ~DelaunayConstraint() {} + virtual ~DelaunayConstraint(); typedef std::vector< int* > trilist; // array of indices in points array defining triangles diff --git a/src/osgUtil/DelaunayTriangulator.cpp b/src/osgUtil/DelaunayTriangulator.cpp index 8fef869b9..658631549 100644 --- a/src/osgUtil/DelaunayTriangulator.cpp +++ b/src/osgUtil/DelaunayTriangulator.cpp @@ -1372,4 +1372,13 @@ void DelaunayConstraint::handleOverlaps(void) tscx->retessellatePolygons(*this); // find all edges } +DelaunayConstraint::~DelaunayConstraint() +{ + trilist::const_iterator ti; + for (ti=_interiorTris.begin(); ti!=_interiorTris.end(); ++ti) + { + delete[] *ti; + } +} + } // namespace osgutil