[geos-commits] r2698 - in trunk/source: headers/geos/linearref
linearref
svn_geos at osgeo.org
svn_geos at osgeo.org
Fri Oct 23 06:21:16 EDT 2009
Author: strk
Date: 2009-10-23 06:21:15 -0400 (Fri, 23 Oct 2009)
New Revision: 2698
Modified:
trunk/source/headers/geos/linearref/LinearGeometryBuilder.h
trunk/source/linearref/LinearGeometryBuilder.cpp
Log:
Add destructor to LinearGeometryBuilder fixing memory leaks there.
Modified: trunk/source/headers/geos/linearref/LinearGeometryBuilder.h
===================================================================
--- trunk/source/headers/geos/linearref/LinearGeometryBuilder.h 2009-10-23 10:13:12 UTC (rev 2697)
+++ trunk/source/headers/geos/linearref/LinearGeometryBuilder.h 2009-10-23 10:21:15 UTC (rev 2698)
@@ -44,8 +44,12 @@
{
private:
const geom::GeometryFactory* geomFact;
- std::vector<geom::Geometry *> lines;
+ typedef std::vector<geom::Geometry *> GeomPtrVect;
+
+ // Geometry elements owned by this class
+ GeomPtrVect lines;
+
bool ignoreInvalidLines;
bool fixInvalidLines;
geom::CoordinateSequence* coordList;
@@ -55,6 +59,8 @@
public:
LinearGeometryBuilder(const geom::GeometryFactory* geomFact);
+ ~LinearGeometryBuilder();
+
/**
* Allows invalid lines to be ignored rather than causing Exceptions.
* An invalid line is one which has only one unique point.
Modified: trunk/source/linearref/LinearGeometryBuilder.cpp
===================================================================
--- trunk/source/linearref/LinearGeometryBuilder.cpp 2009-10-23 10:13:12 UTC (rev 2697)
+++ trunk/source/linearref/LinearGeometryBuilder.cpp 2009-10-23 10:21:15 UTC (rev 2698)
@@ -149,5 +149,15 @@
return geomFact->buildGeometry(lines);
}
+/* public */
+LinearGeometryBuilder::~LinearGeometryBuilder()
+{
+ for (GeomPtrVect::const_iterator i=lines.begin(), e=lines.end();
+ i != e; ++i)
+ {
+ delete *i;
+ }
+}
+
} // namespace geos.linearref
} // namespace geos
More information about the geos-commits
mailing list