[geos-commits] r2655 - in trunk/source: headers/geos/operation/buffer operation/buffer

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Oct 5 14:40:13 EDT 2009


Author: strk
Date: 2009-10-05 14:40:11 -0400 (Mon, 05 Oct 2009)
New Revision: 2655

Modified:
   trunk/source/headers/geos/operation/buffer/OffsetCurveBuilder.h
   trunk/source/headers/geos/operation/buffer/OffsetCurveSetBuilder.h
   trunk/source/operation/buffer/OffsetCurveSetBuilder.cpp
Log:
Document more memory management issues


Modified: trunk/source/headers/geos/operation/buffer/OffsetCurveBuilder.h
===================================================================
--- trunk/source/headers/geos/operation/buffer/OffsetCurveBuilder.h	2009-10-05 17:20:45 UTC (rev 2654)
+++ trunk/source/headers/geos/operation/buffer/OffsetCurveBuilder.h	2009-10-05 18:40:11 UTC (rev 2655)
@@ -83,8 +83,9 @@
 	 * Lines are assumed to <b>not</b> be closed (the function will not
 	 * fail for closed lines, but will generate superfluous line caps).
 	 *
-	 * @param lineList the std::vector to which CoordinateSequences will
-	 *                 be pushed_back
+	 * @param lineList the std::vector to which the newly created
+	 *                 CoordinateSequences will be pushed_back.
+	 *                 Caller is responsible to delete these new elements.
 	 */
 	void getLineCurve(const geom::CoordinateSequence* inputPts,
 	                  double distance,

Modified: trunk/source/headers/geos/operation/buffer/OffsetCurveSetBuilder.h
===================================================================
--- trunk/source/headers/geos/operation/buffer/OffsetCurveSetBuilder.h	2009-10-05 17:20:45 UTC (rev 2654)
+++ trunk/source/headers/geos/operation/buffer/OffsetCurveSetBuilder.h	2009-10-05 18:40:11 UTC (rev 2655)
@@ -83,12 +83,14 @@
 	/**
 	 * Creates a noding::SegmentString for a coordinate list which is a raw
 	 * offset curve, and adds it to the list of buffer curves.
-	 * The noding::SegmentString is tagged with a geomgraph::Label giving the topology
-	 * of the curve.
+	 * The noding::SegmentString is tagged with a geomgraph::Label
+	 * giving the topology of the curve.
 	 * The curve may be oriented in either direction.
 	 * If the curve is oriented CW, the locations will be:
 	 * - Left: Location.EXTERIOR
 	 * - Right: Location.INTERIOR
+	 *
+	 * @param coord is raw offset curve, ownership transferred here
 	 */
 	void addCurve(geom::CoordinateSequence *coord, int leftLoc,
 			int rightLoc);
@@ -182,6 +184,10 @@
 	std::vector<noding::SegmentString*>& getCurves();
 
 	/// Add raw curves for a set of CoordinateSequences
+	//
+	/// @param lineList is a list of CoordinateSequence, ownership
+	///        of which is transferred here.
+	///
 	void addCurves(const std::vector<geom::CoordinateSequence*>& lineList,
 		int leftLoc, int rightLoc);
 

Modified: trunk/source/operation/buffer/OffsetCurveSetBuilder.cpp
===================================================================
--- trunk/source/operation/buffer/OffsetCurveSetBuilder.cpp	2009-10-05 17:20:45 UTC (rev 2654)
+++ trunk/source/operation/buffer/OffsetCurveSetBuilder.cpp	2009-10-05 18:40:11 UTC (rev 2655)
@@ -70,8 +70,9 @@
 {
 	for (size_t i=0, n=curveList.size(); i<n; ++i)
 	{
-		delete curveList[i]->getCoordinates();
-		delete curveList[i];
+		SegmentString* ss = curveList[i];
+		delete ss->getCoordinates();
+		delete ss;
 	}
 	for (size_t i=0, n=newLabels.size(); i<n; ++i)
 		delete newLabels[i];
@@ -92,7 +93,7 @@
 {
 	for (size_t i=0, n=lineList.size(); i<n; ++i)
 	{
-		CoordinateSequence *coords=lineList[i];
+		CoordinateSequence *coords = lineList[i];
 		addCurve(coords, leftLoc, rightLoc);
 	}
 }



More information about the geos-commits mailing list