[geos-commits] r2231 - in trunk/source/operation: buffer linemerge

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Jan 5 18:42:08 EST 2009


Author: swongu
Date: 2009-01-05 18:42:08 -0500 (Mon, 05 Jan 2009)
New Revision: 2231

Modified:
   trunk/source/operation/buffer/BufferBuilder.cpp
   trunk/source/operation/buffer/OffsetCurveVertexList.h
   trunk/source/operation/linemerge/LineMerger.cpp
Log:
Fixed memory leak in BufferBuilder (#218); added read-only coordinates function in OffsetCurveVertexList; explicity pass ownership in LineMerger.

Modified: trunk/source/operation/buffer/BufferBuilder.cpp
===================================================================
--- trunk/source/operation/buffer/BufferBuilder.cpp	2008-11-26 19:47:22 UTC (rev 2230)
+++ trunk/source/operation/buffer/BufferBuilder.cpp	2009-01-05 23:42:08 UTC (rev 2231)
@@ -190,6 +190,8 @@
 		// just in case ...
 		if ( resultPolyList->empty() )
 		{
+			for (size_t i=0, n=subgraphList.size(); i<n; i++)
+				delete subgraphList[i];
 			return createEmptyResultGeometry();
 		}
 

Modified: trunk/source/operation/buffer/OffsetCurveVertexList.h
===================================================================
--- trunk/source/operation/buffer/OffsetCurveVertexList.h	2008-11-26 19:47:22 UTC (rev 2230)
+++ trunk/source/operation/buffer/OffsetCurveVertexList.h	2009-01-05 23:42:08 UTC (rev 2231)
@@ -148,6 +148,14 @@
 		return ptList;
 	}
 
+	// Added getCoordinatesRO(), which returns the coordinates without
+	// passing ownership to the caller.
+	const geom::CoordinateSequence* getCoordinatesRO()
+	{
+		closeRing();
+		return ptList;
+	}
+
 };
 
 } // namespace geos.operation.buffer

Modified: trunk/source/operation/linemerge/LineMerger.cpp
===================================================================
--- trunk/source/operation/linemerge/LineMerger.cpp	2008-11-26 19:47:22 UTC (rev 2230)
+++ trunk/source/operation/linemerge/LineMerger.cpp	2009-01-05 23:42:08 UTC (rev 2231)
@@ -207,7 +207,11 @@
 LineMerger::getMergedLineStrings()
 {
 	merge();
-	return mergedLineStrings;
+
+	// Explicitly give ownership to the caller.
+	vector<LineString*>* ret = mergedLineStrings;
+	mergedLineStrings = NULL;
+	return ret;
 }
 
 } // namespace geos.operation.linemerge



More information about the geos-commits mailing list